Form won’t close to open main
I have a login page and a main page. On my login page, I has this for the code and everything works fine.
Private Sub btn_login_Click()
If DCount(“uusername”, “usertable”, “uusername= ‘” & txt_username & “‘ and upassword= ‘” & txt_password & “‘”) = 0 Then
Me.lbl_incorrect.Visible = True
Else
DoCmd.Close acForm, “LoginForm”
DoCmd.OpenForm “MainForm”
End If
End Sub
On my main page I have this code when logging out. Some reason when I click yes it just sits there on that form. I don’t know what I am missing.
Private Sub btn_logout_Click()
respond = MsgBox(“Do you really want to logout?”, vbYesNo + vbQuestion, “| Logout Confirmation |”)
If response = vbYes Then
DoCmd.Close acForm, “MainForm”, acSaveNo
DoCmd.OpenForm “LoginForm”
Else
Cancel = True
End If
End Sub
I have a login page and a main page. On my login page, I has this for the code and everything works fine. Private Sub btn_login_Click()
If DCount(“uusername”, “usertable”, “uusername= ‘” & txt_username & “‘ and upassword= ‘” & txt_password & “‘”) = 0 Then
Me.lbl_incorrect.Visible = True
Else
DoCmd.Close acForm, “LoginForm”
DoCmd.OpenForm “MainForm”
End If
End Sub On my main page I have this code when logging out. Some reason when I click yes it just sits there on that form. I don’t know what I am missing. Private Sub btn_logout_Click()
respond = MsgBox(“Do you really want to logout?”, vbYesNo + vbQuestion, “| Logout Confirmation |”)
If response = vbYes Then
DoCmd.Close acForm, “MainForm”, acSaveNo
DoCmd.OpenForm “LoginForm”
Else
Cancel = True
End If
End Sub Read More