RedDucati748
MIS
I'm having difficulty with the code for a simple input box that I'm using to input a password. I’ve created the input box and hard coded a password, however I’m having an error come up when I enter in an incorrect password more than one time. I also can’t get the cancel command button on the input box to unload the input box or the close command on the title bar. I’ve listed the code below, if anyone has further questions or can help from what I’ve given, that would be great.
Thanks-
Private Sub Form_Load()
Dim strAns As String
Dim strPwd As String
Dim cmdCancel As CommandButton
strPwd = "password"
strAns = InputBox("Enter Password:", "Password Required"![Wink ;) ;)](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
If "" = strAns Then
Unload Me
ElseIf strPwd <> strAns Then
MsgBox "Wrong Password", vbInformation
strAns = InputBox("Enter Password:", "Password
Required"![Wink ;) ;)](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
Unload Me
End If
End Sub
Thanks-
Private Sub Form_Load()
Dim strAns As String
Dim strPwd As String
Dim cmdCancel As CommandButton
strPwd = "password"
strAns = InputBox("Enter Password:", "Password Required"
If "" = strAns Then
Unload Me
ElseIf strPwd <> strAns Then
MsgBox "Wrong Password", vbInformation
strAns = InputBox("Enter Password:", "Password
Required"
Unload Me
End If
End Sub