SetanPutih
Registered User.
- Local time
- Today, 01:58
- Joined
- Jun 27, 2019
- Messages
- 27
Hi,
Hope someone can help with this. I want Admin to be directed to a different form after login. Currently all Employees are directed to Form1. I want Admin to be directed to Main. The login code can be seen below. Can anybody help please?
Private Sub cmdLogin_Click()
Dim strID As String
strID = DLookup("[EmployeeID]", "Employees", "[UserName]='" & Me.cboUser.Column(1) & "" & "' And Password = '" & Me.txtPassword & "" & "'") & ""
If strID <> "" Then
gEmployeeID = strID
Forms!Form1!lblWelcome.Caption = "Welcome " & Me.cboUser.Column(1) & " " & Me.cboUser.Column(2)
DoCmd.Close acForm, Me.Name
Else
MsgBox "Invalid User or Password. Please try again.", vbInformation + vbOKOnly
End If
End Sub
Private Sub Form_Close()
If gEmployeeID = "" Then Application.Quit
End Sub
Hope someone can help with this. I want Admin to be directed to a different form after login. Currently all Employees are directed to Form1. I want Admin to be directed to Main. The login code can be seen below. Can anybody help please?
Private Sub cmdLogin_Click()
Dim strID As String
strID = DLookup("[EmployeeID]", "Employees", "[UserName]='" & Me.cboUser.Column(1) & "" & "' And Password = '" & Me.txtPassword & "" & "'") & ""
If strID <> "" Then
gEmployeeID = strID
Forms!Form1!lblWelcome.Caption = "Welcome " & Me.cboUser.Column(1) & " " & Me.cboUser.Column(2)
DoCmd.Close acForm, Me.Name
Else
MsgBox "Invalid User or Password. Please try again.", vbInformation + vbOKOnly
End If
End Sub
Private Sub Form_Close()
If gEmployeeID = "" Then Application.Quit
End Sub