J
Jim/Chris
Here are two methods from Howard Brody and Matt Weyland
On the click event for the button add the following code.
dim strPW as string
strPW = inputbox("Please enter password to go to next
form","Enter Password")
if strPW = "password" then 'or what ever you want it to be
docmd.openform "Next form"
else
msgbox "The password did not match, please try again."
end if
That should do it.
Matt Weyland
Or
Try this code in the OnClick event for the CommandButton:
Private Sub cmdGoToNextForm_Click()
' declare variables
Dim strMsg As String
Dim strPW As String
' prompt user for password
strMsg = "Please enter the password for the next form:"
strPW = InputBox(strMsg)
' compare entered password to actual password ("LetMeIn") and
' either open the nect form or display an error message
(depending
' on whether it matches)
If strPW = "LetMeIn" Then
DoCmd.OpenForm "frmNextForm"
DoCmd.Close acForm, Me.Name
Else
strMsg = "You entered an incorrect password."
MsgBox strMsg, vbOKOnly, "Oops!"
Exit Sub
End If
End Sub
Hope this helps!
Howard Brody
..
Jim
a password to access where ever the cmd button takes you
(ie and Administration switchboard). Thanks.
On the click event for the button add the following code.
dim strPW as string
strPW = inputbox("Please enter password to go to next
form","Enter Password")
if strPW = "password" then 'or what ever you want it to be
docmd.openform "Next form"
else
msgbox "The password did not match, please try again."
end if
That should do it.
Matt Weyland
Or
Try this code in the OnClick event for the CommandButton:
Private Sub cmdGoToNextForm_Click()
' declare variables
Dim strMsg As String
Dim strPW As String
' prompt user for password
strMsg = "Please enter the password for the next form:"
strPW = InputBox(strMsg)
' compare entered password to actual password ("LetMeIn") and
' either open the nect form or display an error message
(depending
' on whether it matches)
If strPW = "LetMeIn" Then
DoCmd.OpenForm "frmNextForm"
DoCmd.Close acForm, Me.Name
Else
strMsg = "You entered an incorrect password."
MsgBox strMsg, vbOKOnly, "Oops!"
Exit Sub
End If
End Sub
Hope this helps!
Howard Brody
..
Jim
a cmd button. So that upon click you are required to enter-----Original Message-----
Can you create a macro to require a password and tie it to
a password to access where ever the cmd button takes you
(ie and Administration switchboard). Thanks.