I have a table called tblUserID with fields UserId and Password. I have a form called frmLogin that have text boxes called UserID and Password. I put a cmd button called cmdEnter and need it to validate the userid and password in the text boxes against those in the table. This is my best guess on the code
Quote:
Private Sub cmdEnter_Click() On Error GoTo Err_cmdEnter_Click If Me.userID = tblUserID.UserID and me.password = tblUserID.Password Then DoCmd.Openform “frmDashboard” Else MsgBox ("The username and or password you entered is invalid”) Me.userID.SetFocus End If Exit_cmdEnter_Click: Exit Sub Err_cmdEnter_Click: MsgBox Err.Description Resume Exit_cmdEnter_Click End Sub |