I have been using Access for a while now and while not an expert feel failrly comfortable with it. I have a form with a command button that launches another form but has to have the correct password for the load event to continue. If the password is correct then all works well. If not then the code says to close the form and return to the original screen. However, when the password is not correct it not only aborts opening the form but closes the original form as well. I have tried to see what is causing this but I simply cannot find out why. Any help[ is appreciated. Below is the script.
Private Sub Form_Load()
Dim PassWord As String
PassWord = InputBox("Enter Password")
If PassWord = "pass" Then
' Open Form
DoCmd.OpenForm "frmDataManage"
Else
MsgBox ("You're not authorized")
DoCmd.Close acForm, "frmDataManage"
DoCmd.OpenForm "frmMainScreen"
End If