How to restrict log-in from 5-8 pm ?

J

Jimbo213

On an earlier post I was wanting code to kick users off an application at 5pm
so I can do maintenance, code changes, etc. [Yes I also got answers about
splitting the database but let's not go there for this post].

Dave Hargis [MVP] solution was to use this code:
Me.TimerInterval = Datediff("s",Time, TimeSerial(17,0,0)) * 1000
Dave's code works perfect. The interval is set to the remaining seconds
from a person's log-in time to 1700 hours. Form_timer then executes
Application.Quit acQuitSaveAll. Neat trick - thanks Dave.

Question: What happens when anyone logs-in at 5:01 pm and the
Me.TimerInterval is then set to minus 1 minute? How does MS-Access respond?
Will it also let anyone who logs-in at 5:01 remain in the application and,
therefore, still lock it from my maintenance work?

In addition to the above "kick-off" code, I need to be able to be the only
login available from 5:01pm to 8:00pm.
Application.CurrentUser = "jeb5" <---- that's me

How to accomplish that?

Can I just do this on the switchboard form [auto-loads for all login]

If (Time > 1700 Or Time < 2000) And Application.CurrentUser <> "jeb5" then
MsgBox "Restricted Sign-On between 5-7 pm"
Cancel = True
Else
Me.TimerInterval = Datediff("s",Time, TimeSerial(17,0,0)) * 1000
End If

[please correct any syntax errors in above or provide a better way]

Thanks for your reply & assistance.
Jimbo213
 
D

Douglas J. Steele

Sorry, but why should we "not go there" about splitting the database? You
seem to be trying to build some kind of bandaid solution for something that
shouldn't be an issue if you did it properly!
 

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