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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Closing database connection in VBA

Status
Not open for further replies.

Smoothcat74

Technical User
Aug 29, 2008
40
0
0
Hey guys,

I need VBA to compact a database for me but first I need to make sure the database is not in use by the front-end application. Is there a quick way to disconnect from the back-end to ensure the compact will go smoothly?

Regards...
 
I don't know of a quick way to do this...what I have used in the past is a timer on a form in the frontend that checks a yes/no "shutdown" field in the backend. If the field is yes, then run an Application.Quit.

You might want to add a warning to the user that the application is about to quit as well so they can finish up what they are working on.
 
You could use the dir function to see if the ldb file exists. This is only valid if all users can create an ldb file. If they can't you'll probably get an error at somepoint anyways.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top