I have a form called "Maintenance" that when opened asks the user to provide a password. This part works well. The problem I have is when I get an error (the wrong password is entered) I want to go back to the previous form called "Navigation". This is the part that doesn't quite work. The message box populates telling me "Wrong Password" but the "Navigation" form never opens. Appreciate any help on this.
Code:
Private Sub Form_Open(Cancel As Integer)
On Error GoTo Error_Handler
If StrComp(InputBox("Please enter the Password"), "Password", 0) <> 0 Then
Cancel = True
MsgBox "Wrong password.", vbInformation Or vbOKOnly, "Operation cancelled"
End If
Exit_Maintenance_form:
DoCmd.OpenForm "Navigation"
Exit Sub
Error_Handler:
Resume Exit_Maintenance_form
End Sub