Disable logins on a Access database for a period of time

G

guv

We have a microsoft access 2003 database. Everynight a procedure is setup
to run, but if anyone is connected or logged onto the access database the
procedure fails.

Is there a automate way we can make sure that that no one is logged or
connected to this access database for a period of time.
 
K

Klatuu

If you have a form that opens when your application opens, then you can use
the Open event of that form to determine if the time is between certain
hours and if it is, then quit the application. In this example, it will not
let you log in after 10:00 PM or before 6:00 AM

Private Sub Form_Open(Cancel As Integer)

If Time > #22:00:00# And Time < #06:00:00# Then
MsgBox "Sorry, I am Off Duty"
Docmd.Quit
End If

End Sub

Now, there is one other problem. That is, if someone logs on before 10:00
PM, but is not out of the database by the time the overnight procedure is
due to run, it will still fail.

The only way to protect against that problem is to have a form (it can be
hidden) that is always open. You would use that form's Timer event to
periodically check the current time, and if it is after your cut-off time,
quit the application.
 

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

Top