MsgBox Retry/Cancel

whirlwindgirl

New member
Local time
Today, 03:58
Joined
Apr 13, 2011
Messages
4
I have 3 Switchboard options that I need to password protect. The code below works if the password is correct. If incorrect, it does popup the message box with Wrong Password but when I click on Retry or Cancel I get nothing. What code should I have to make the Retry popup the InputBox and the Cancel to exit the current SwitchboardID from 2 to 1 (Main Switchboard). Is that even possible?


Private Sub Form_Current()
' Update the caption and fill in the list of options.
Me.Caption = Nz(Me![ItemText], "")
FillOptions
If Me.SwitchboardID = 2 Then
Dim x As String
x = "Password1"
Dim y As String
y = InputBox("Please Enter a Valid Password", "PASSWORD REQUIRED")
If x = y Then
MsgBox "Correct Password", 0, "SUCCESS!"
If x <> y Then
MsgBox "WRONG PASSWORD", 53, "INVALID PASSWORD"
End If
End If
End If
If Me.SwitchboardID = 3 Then
Dim x1 As String
x1 = "Password2"
Dim y1 As String
y1 = InputBox("Please Enter a Valid Password", "PASSWORD REQUIRED")
If x1 = y1 Then
MsgBox "Correct Password", 0, "SUCCESS!"
If x1 <> y1 Then
MsgBox "WRONG PASSWORD", 53, "INVALID PASSWORD"
End If
End If
End If
If Me.SwitchboardID = 4 Then
Dim x2 As String
x2 = "Password 3"
Dim y2 As String
y2 = InputBox("Please Enter a Valid Password", "PASSWORD REQUIRED")
If x2 = y2 Then
MsgBox "Correct Password", 0, "SUCCESS!"
If x2 <> y2 Then
MsgBox "WRONG PASSWORD", 53, "INVALID PASSWORD"
End If
End If
End If
End Sub
 
You are using the msgbox not as intended

Code:
If MsgBox("Incorrect Password",vbExclamation+VbRetryCancel,"Invalid Password) = vbRetry Then
   '/Do this
Else
   '/Do That
End if
 
I didn't think I was. Thanks, that makes sense to me now. I've kinda been thrown into this without much experience. Thanks for your help!!!
 

Users who are viewing this thread

Back
Top Bottom