SOLVED

Form won't close to open main

Copper Contributor

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

 

 

3 Replies
best response confirmed by itsmatta (Copper Contributor)
Solution
Is "response" the same thing as "respond"?

Do you have Option Explicit declared at the top of this module--and of every other module in this database?
Facepalm.....respond should've been response

also option explicit isn't. What does that do? Still learning, but appreciate you spotting the issue
1 best response

Accepted Solutions
best response confirmed by itsmatta (Copper Contributor)
Solution
Is "response" the same thing as "respond"?

Do you have Option Explicit declared at the top of this module--and of every other module in this database?

View solution in original post