Bear with me guys cause as you can tell i am a novice with this!
OK I have an entry form with 2 buttons. One button has apassword as its restricted to certain staff only. When the button is pressed and the staff enters the correct password I want the form to close and the "access window" be viewable so they can go into tables, queries, whatever they want.
This is so other staff cant go in and mess about-i was asked to specifically set it up this way as well!
So here is the code i have so far
rivate Sub Command14_Click()
'attached to On Click event of cmdOpenEmpForm
Dim strPasswd
strPasswd = InputBox("Please enter password", "Restricted Information")
'Check to see if there is amy entry made to input box of if
'cancel button is pressed.If no entry made then end sub.
If strPasswd = "" Or strPasswd = Empty Then
MsgBox "No password entered", vbInformation, "Required Information"
Exit Sub
End If
'If correct password is entered open Employees form
'If incorrect password entered gice message and exit sub
If strPasswd = "lisa" Then
DoCmd.OpenForm "entry", acNormal
Else
MsgBox "Sorry you do not have access to this area", vbOKOnly, "Important Information!"
Exit Sub
End If
End Sub
So if they get wrong password they get message but I am not sure of the code to add to simply close the form if they get it right.
What a waffler!!! Can anyone help???
OK I have an entry form with 2 buttons. One button has apassword as its restricted to certain staff only. When the button is pressed and the staff enters the correct password I want the form to close and the "access window" be viewable so they can go into tables, queries, whatever they want.
This is so other staff cant go in and mess about-i was asked to specifically set it up this way as well!
So here is the code i have so far

'attached to On Click event of cmdOpenEmpForm
Dim strPasswd
strPasswd = InputBox("Please enter password", "Restricted Information")
'Check to see if there is amy entry made to input box of if
'cancel button is pressed.If no entry made then end sub.
If strPasswd = "" Or strPasswd = Empty Then
MsgBox "No password entered", vbInformation, "Required Information"
Exit Sub
End If
'If correct password is entered open Employees form
'If incorrect password entered gice message and exit sub
If strPasswd = "lisa" Then
DoCmd.OpenForm "entry", acNormal
Else
MsgBox "Sorry you do not have access to this area", vbOKOnly, "Important Information!"
Exit Sub
End If
End Sub
So if they get wrong password they get message but I am not sure of the code to add to simply close the form if they get it right.
What a waffler!!! Can anyone help???