Welcome to dbFreaks.com!
FAQFAQ      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

Detect an Open Database

 
   Database Help (Home) -> Visual Basic -> DAO RSS
Next:  DAO360.DLL on W2K and XP  
Author Message
John Clayton

External


Since: Nov 26, 2003
Posts: 2



(Msg. 1) Posted: Wed Nov 26, 2003 4:45 pm
Post subject: Detect an Open Database
Archived from groups: microsoft>public>vb>database>dao (more info?)

I use a lot of Set db = OpenDatabase..... and db.close
with DAO in my programme. I also have to Compact the
Database from time to time. On occasions I miss a db.close
then obviously Compact will not work as the database is
still open.
How do I detect that the database is still open, once I
know this I can write:
If database still open then db.close and then use Compact.

 >> Stay informed about: Detect an Open Database 
Back to top
Login to vote
Joe Nuke Me Xemu F

External


Since: Nov 30, 2003
Posts: 96



(Msg. 2) Posted: Wed Nov 26, 2003 5:09 pm
Post subject: Re: Detect an Open Database [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

"John Clayton" <anonymous.RemoveThis@discussions.microsoft.com> wrote in message <news:03c701c3b466$9b175f90$a401280a@phx.gbl>...

 > I use a lot of Set db = OpenDatabase..... and db.close
 > with DAO in my programme. I also have to Compact the
 > Database from time to time. On occasions I miss a db.close
 > then obviously Compact will not work as the database is
 > still open.
 > How do I detect that the database is still open, once I
 > know this I can write:
 > If database still open then db.close and then use Compact.

I always explicitly Set objects = Nothing after I Close or
Quit them or whatever, so if the reference Is Nothing, it's
dead, otherwise it's live. I'm not sure if this technique
is anathema to anyone besides Steven A. Mitchell, though.

--
Joe Foster <mailto:jlfoster%40znet.com> "Regged" again? <http://www.xenu.net/>
WARNING: I cannot be held responsible for the above They're coming to
because my cats have apparently learned to type. take me away, ha ha!<!-- ~MESSAGE_AFTER~ -->

 >> Stay informed about: Detect an Open Database 
Back to top
Login to vote
John Clayton

External


Since: Nov 26, 2003
Posts: 2



(Msg. 3) Posted: Thu Nov 27, 2003 5:23 am
Post subject: Re: Detect an Open Database [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Joe,

I tried Set db = Nothing, but it did not work (there is
still a link to the database).

db.close works but I need to know that the database is
open before I can close it.

 >-----Original Message-----
 >"John Clayton" <anonymous DeleteThis @discussions.microsoft.com>
wrote in message <news:03c701c3b466$9b175f90
$a401280a@phx.gbl>...
 >
  >> I use a lot of Set db = OpenDatabase..... and db.close
  >> with DAO in my programme. I also have to Compact the
  >> Database from time to time. On occasions I miss a
db.close
  >> then obviously Compact will not work as the database is
  >> still open.
  >> How do I detect that the database is still open, once I
  >> know this I can write:
  >> If database still open then db.close and then use
Compact.
 >
 >I always explicitly Set objects = Nothing after I Close or
 >Quit them or whatever, so if the reference Is Nothing,
it's
 >dead, otherwise it's live. I'm not sure if this technique
 >is anathema to anyone besides Steven A. Mitchell, though.
 >
 >--
 >Joe Foster <mailto:jlfoster%40znet.com> "Regged" again?
<http://www.xenu.net/>
 >WARNING: I cannot be held responsible for the
above They're coming to
 >because my cats have apparently learned to
type. take me away, ha ha!
 >
 >
 >.
 ><!-- ~MESSAGE_AFTER~ -->
 >> Stay informed about: Detect an Open Database 
Back to top
Login to vote
Richard Liddiment

External


Since: Nov 28, 2003
Posts: 1



(Msg. 4) Posted: Fri Nov 28, 2003 8:40 pm
Post subject: Re: Detect an Open Database [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Something like this should do the trick:

Do While Workspaces(0).Databases.count > 0
Workspaces(0).Databases(0).Close
Loop

Richard

"John Clayton" <anonymous DeleteThis @discussions.microsoft.com> wrote in message
news:03c701c3b466$9b175f90$a401280a@phx.gbl...
 > I use a lot of Set db = OpenDatabase..... and db.close
 > with DAO in my programme. I also have to Compact the
 > Database from time to time. On occasions I miss a db.close
 > then obviously Compact will not work as the database is
 > still open.
 > How do I detect that the database is still open, once I
 > know this I can write:
 > If database still open then db.close and then use Compact.<!-- ~MESSAGE_AFTER~ -->
 >> Stay informed about: Detect an Open Database 
Back to top
Login to vote
Display posts from previous:   
Related Topics:
VB6 Access 2000 : Error 3085 undefined function, works wh.. - I've been using VB6 with DAO 3.6 and an Access 2000 format database fine for a few years. I recently added a module function that one of the Access queries uses. It is only called from with the Access query. When I try to set the first parameter from....

Problem with 'Dim' ..... As Database ??? - It's worked perfectly in the past. When I have a 'Dim MyDb As Database' statement in my program, it rejects it saying'User-defined type not Declared' (I have checked that the 'VB' library where this resides is available, and it works on new projects..

DAO 3.6 record locking - Hi, Is it possible to programmatically lock a single record in a VB application using DAO 3.6? I would like to lock users' records when they log on to the app. Later I can check if a user's record is locked to see if they are logged in or not. (I....

Fixes for VB4 or DAO 3.0 - I've got VB4 (32-bit) and it seems to use DAO 3.0. Is there a service pack for either of these that I can use? I'm having issues with DAO and > 2GB of RAM on the machine, and don't want to have to move to a newer version of VB if I can help it, just t...

Jet error - I've just started getting this error message on a seemingly random basis. 'The Microsoft Jet database engine does not recognize 'CID' as a valid field name or expression.' CID is a text field, and it is a valid column name. The line of code that..
   Database Help (Home) -> Visual Basic -> DAO All times are: Pacific Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You can edit your posts in this forum
You can delete your posts in this forum
You can vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]