Block access to MS access at night time with error message

Here is the question: How to block access to MS access at night time with an error message?
LVL 16
SSupremeAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

SSupremeAuthor Commented:
Surely, it is for single .mdb file, not for whole application.
0
JVWCCommented:
Depending on how secure you want this to be...
A simple method:
This code in a form, set as the default form for opening.
One textbox on the form [text0] set to =time()
Or simply test against the time component of Now()

Can be bypassed using shift key
JC
Private Sub Form_Load()
If Me.Text0 < #5:00:00 PM# And Me.Text0 > #6:00:00 AM# Then
    DoCmd.OpenForm ("myNormalOpeningFormName")
    DoCmd.Close acForm, Me.Name, acSaveNo

Else
    If MsgBox("It's dark outside" & vbCr & "Closing App", , "Can't work in the dark!") = vbOK Then
    DoCmd.Close acForm, Me.Name, acSaveNo
    Application.Quit
    End If

End If

End Sub

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
SSupremeAuthor Commented:
Not exactly what I am looking for.
I think it should be in module.
Like this one I already have:
Function IsLoaded(ByVal strFormName As String) As Integer
    
    Const conObjStateClosed = 0
    Const conDesignView = 0
    
    If SysCmd(acSysCmdGetObjectState, acForm, strFormName) <> conObjStateClosed Then
        If Forms(strFormName).CurrentView <> conDesignView Then
            IsLoaded = True
        End If
    End If
    
End Function

Open in new window

0
SSupremeAuthor Commented:
Actually, it is possible solution.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.