Locking a database

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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
 
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 ...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Record-Locking remains open after closing 0
ldb locked 4
Preventing Record Locked 2
Lock VBA 9
Using multiple databases 3
Record Locking 4
Locking Issue 1
Record Locking 2

Back
Top