G
Greg Staley
I am putting a simple password protection in a command button's OnClick.
Here is what I have.... It brings up the box, but if you put anything in the
box, or cancel, it opens the form anyway. Can someone help me figure out
why it is not working?
Greg
The Oft Access Confused
Private Sub cmdOpenAdminMenu_Click()
On Error GoTo Err_cmdOpenAdminMenu_Click
Dim sPassword As String
Const sAccess = "password"
sPassword = InputBox("Please enter the password now", "Login")
If sPassword <> sAccess Then
Cancel = True
End If
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmAdmin"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_cmdOpenAdminMenu_Click:
Exit Sub
Here is what I have.... It brings up the box, but if you put anything in the
box, or cancel, it opens the form anyway. Can someone help me figure out
why it is not working?
Greg
The Oft Access Confused
Private Sub cmdOpenAdminMenu_Click()
On Error GoTo Err_cmdOpenAdminMenu_Click
Dim sPassword As String
Const sAccess = "password"
sPassword = InputBox("Please enter the password now", "Login")
If sPassword <> sAccess Then
Cancel = True
End If
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmAdmin"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_cmdOpenAdminMenu_Click:
Exit Sub