I searched the forums but did not find a solution to my problem. Any help would be very appreciated. Further more, answering this question would answer about 35 other questions I have.
Code:
Private Sub cmdLogin_Click()
On Error GoTo ErrorPoint
If Len(Nz(Me!txtUserName, "")) = 0 Then
' User Name box is empty
MsgBox "Please select your user name before continuing.", _
vbInformation, "Enter User Name"
Me.txtUserName.SetFocus
GoTo ExitPoint
End If
If Len(Nz(Me!txtPassword, "")) = 0 Then
' Password box is empty
MsgBox "Please enter your password before continuing.", _
vbInformation, "Missing Password"
Me.txtPassword.SetFocus
GoTo ExitPoint
End If
ExitPoint:
Exit Sub
ErrorPoint:
MsgBox "The following error has occurred:" _
& vbNewLine & "Error Number: " & Err.Number _
& vbNewLine & "Error Description: " & Err.Description _
, vbExclamation, "Unexpected Error"
Resume ExitPoint
End Sub
This is the code I have for my login button. I have linked the tables to my access project. The table is called.
tblUsers
The four keys in the table is.
Employee ID | AccessLevel | Username | Password
The form I am trying to open when a correct authentication is processed is.
Main
Any help would really be appreciated. By seeing a working example of this it would answer several key questions I have.
Note: The txtUserName box is actually a combo-box with a drop down of the user names.