Locking a database

C

Chris E.

Is there a way to lock a database until a certain time? I don't want users
to be able to open it until say 9:00 am. Reason is some of my data is not
finished exporting yet and if someone is in the database it will not export.

chris
 
S

Scott McDaniel

Why not just set a flag field when the export is complete ... for example,
add a table (I'll name it USysSystem) that contains a field named
"flgExportFinished" and set this value depending on the status of your
export:

<your export code here>
CurrentDB.Execute "UPDATE USysSystem SET flgExportFinished= True"

Then when users attempt to enter the db, check this value:

If DLookup("flgExportFinished", "USysSystem")<> True Then
MsgBox "Exporting ... please try again later"
Application.Quit
End If

You'd have to reset this each day after all users are out of the system. How
you do that depends on how "automated" you want this to be. If you have a
system that always runs, you could run a form timer that does this, if not
you could build a simple VB or separate Access app to do this ...

If you want to check for the current hour, use the builtin Hour function:

If Hour(Now) < 9 Then
Msgbox "Please come back after 9:00 a.m."
Application.Quit
End If

However, I'm not entirely sure how this will work ...
 
Top