Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Private Sub Command1_Click()
- Dim UserLevel As Integer
- If IsNull(Me.txtUserName) Then
- MsgBox "Enter UserName", vbInformation, "UserName Required"
- Me.txtUserName.SetFocus
- ElseIf IsNull(Me.txtPassword) Then
- MsgBox "Enter Password", vbInformation, "Password Required"
- Me.txtPassword.SetFocus
- Else
- 'process the job
- If (IsNull(DLookup("UserName", "tblUser", "UserName ='" & Me.txtUserName.Value & "'"))) Or _
- (IsNull(DLookup("Password", "tblUser", "Password ='" & Me.txtPassword.Value & "'"))) Then
- MsgBox "Incorrect UserName or Password"
- Else
- UserLevel = (DLookup("UserSecurity", "tblUser", "UserName = ' " & Me.txtUserName.Value & "'"))
- DoCmd.Close
- If UserLevel = 1 Then
- 'MsgBox "UserName and Password Correct"
- DoCmd.OpenForm "Navigation Form"
- Else
- DoCmd.OpenForm "Main Menu"
- End If
- End If
- End If
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement