koketsomaseko
Registered User.
- Local time
- Today, 14:33
- Joined
- Jun 17, 2014
- Messages
- 11
I need to separate Users and admin on login so that the admin can go to admin form and users to specific form using vba access
here is my login code
Private Sub cmdLogin_Click()
'Check to see if data is entered into the password box
If IsNull(Me.cboUserName) Or Me.cboUserName = "" Then
MsgBox "You must enter a Password.", vbOKOnly, "Required Data"
Me.cboUserName.SetFocus
Exit Sub
End If
'Check to see if data is entered into the password box
If IsNull(Me.PassWordText) Or Me.PassWordText = "" Then
MsgBox "You must enter a Password.", vbOKOnly, "Required Data"
Me.PassWordText.SetFocus
Exit Sub
End If
'Check value of password in tblEmployees to see if this
'matches value chosen in combo box
If Me.PassWordText.Value = DLookup("Password", "Login", _
"[EmployeeID]=" & Me.cboUserName.Value) Then
EmployeeID = Me.cboUserName.Value
'Close logon form and open splash screen
DoCmd.Close acForm, "frmLogin", acSaveNo
DoCmd.OpenForm "Welcome"
ElseIf cboUserName = "koketso" And Password = "12345" Then
MsgBox "Welcome, admin", vbInformation, "Admin Area"
MsgBox "Please Exercise Caution When Altering Back End", vbInformation, "Manager Area"
DoCmd.Close
DoCmd.OpenForm "Admin"
Else
MsgBox "Password Invalid. Please Try Again", vbOKOnly, _
"Invalid Entry!"
Me.PassWordTex
here is my login code
Private Sub cmdLogin_Click()
'Check to see if data is entered into the password box
If IsNull(Me.cboUserName) Or Me.cboUserName = "" Then
MsgBox "You must enter a Password.", vbOKOnly, "Required Data"
Me.cboUserName.SetFocus
Exit Sub
End If
'Check to see if data is entered into the password box
If IsNull(Me.PassWordText) Or Me.PassWordText = "" Then
MsgBox "You must enter a Password.", vbOKOnly, "Required Data"
Me.PassWordText.SetFocus
Exit Sub
End If
'Check value of password in tblEmployees to see if this
'matches value chosen in combo box
If Me.PassWordText.Value = DLookup("Password", "Login", _
"[EmployeeID]=" & Me.cboUserName.Value) Then
EmployeeID = Me.cboUserName.Value
'Close logon form and open splash screen
DoCmd.Close acForm, "frmLogin", acSaveNo
DoCmd.OpenForm "Welcome"
ElseIf cboUserName = "koketso" And Password = "12345" Then
MsgBox "Welcome, admin", vbInformation, "Admin Area"
MsgBox "Please Exercise Caution When Altering Back End", vbInformation, "Manager Area"
DoCmd.Close
DoCmd.OpenForm "Admin"
Else
MsgBox "Password Invalid. Please Try Again", vbOKOnly, _
"Invalid Entry!"
Me.PassWordTex