Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I check if a database is open

Status
Not open for further replies.

Denster

Programmer
Apr 9, 2001
198
GB
Need to put a check in the coding, to see if the database is open. then put an "if not" open it statement in.

Thanks

Denster
 
If it's an Access db, I check for the existence of the dbName.ldb file in the same directory.
 
What do you mean by open? The program already has an open connection to it, or the database is opened by its program (like Access).

If it is the former, what tools are you using? If you are using ADO then check the connection state.
Code:
If CONN.State = adStateOpen then
   'connection is open
Else
   'Not open
End If

zemp
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top