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!

closing access database automatically

Status
Not open for further replies.

jjones100

Technical User
Nov 12, 2004
23
US
I need to FTP my access database to a webserver several times a day. My problem is that for the upload to work I need everyone to close down the database.It never fails that someone is away from their desk and the ftp will fail because they have left the db up. Is there a way to set a macro etc to shut down the database at particular times for particular users?
 
create a new form and set the timer interval to 1000, then add this to the onTimer event.
the timer looks for the file dbname.close every second if it finds it the database closes.

Private Sub Form_Timer()
'if file dbname.close exists then close database.
'this file is in the same folder as the database.
If Dir(Application.CurrentProject.path & "\dbname.close") <> "" Then
DoCmd.Quit acQuitSaveAll
End If
End Sub

create a macro that opens the form and hides it, name the form autoexec. this will open and hide the
form everytime the database is open.

the way i use this is when i want the database to be opened i name the file dbname.open then rename to
.close to close it.
 
Thanks, this set me on the right path. I use the form to check the time throughout the day and then added code for it to close at the appropriate times. I will use your method for closing on the fly.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top