SetanPutih
Registered User.
- Local time
- Yesterday, 20:14
- Joined
- Jun 27, 2019
- Messages
- 27
Hi,
Hope someone can help. I've built an employee database with a login system. What I'm trying to do is, when someone logs in with the name Admin a button becomes visible on the window which the login window leads too which would not be visible to everyone else. The button will be called Admin. The login code I have so far is..
Option Compare Database
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
Thanks for reading.
Hope someone can help. I've built an employee database with a login system. What I'm trying to do is, when someone logs in with the name Admin a button becomes visible on the window which the login window leads too which would not be visible to everyone else. The button will be called Admin. The login code I have so far is..
Option Compare Database
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
Thanks for reading.