I have created a form with 2 txt boxes txtlogin and txtpassword and also i have a login command button on the form. I have run a query on my database called qryemployee which has results for EmployeeID and Password.
I have set this frmlogin to open first. when i click the command button it opens my database. what i want is to add code to the following so it checks my query to see if the employeeID is the same as what was entered in the txtlogin and check that the corresponding password is the valid. and if so go ahead and open database. if not clear txtlogin and txtpassword and get user to reenter details.
Code:
Private Sub Command4_Click()
On Error GoTo Err_Command4_Click
Dim stDocName As String
stDocName = "mcrLogin"
DoCmd.RunMacro stDocName
Exit_Command4_Click:
Exit Sub
Err_Command4_Click:
MsgBox Err.Description
Resume Exit_Command4_Click
End Sub
I have set this frmlogin to open first. when i click the command button it opens my database. what i want is to add code to the following so it checks my query to see if the employeeID is the same as what was entered in the txtlogin and check that the corresponding password is the valid. and if so go ahead and open database. if not clear txtlogin and txtpassword and get user to reenter details.
Code:
Private Sub Command4_Click()
On Error GoTo Err_Command4_Click
Dim stDocName As String
stDocName = "mcrLogin"
DoCmd.RunMacro stDocName
Exit_Command4_Click:
Exit Sub
Err_Command4_Click:
MsgBox Err.Description
Resume Exit_Command4_Click
End Sub