Created
March 19, 2013 02:00
-
-
Save aarontwf/5193095 to your computer and use it in GitHub Desktop.
Simple Access login form code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' Blank Usernames | |
If IsNull(cboUsername) Or cboUsername = "" Then | |
MsgBox "Enter Username", vbOKOnly, "Required Data" | |
cboUsername.SetFocus | |
Exit Sub | |
End If | |
' Blank Passwords | |
If IsNull(txtPassword) Or txtPassword = "" Then | |
MsgBox "Enter Password", vbOKOnly, "Required Data" | |
txtPassword.SetFocus | |
Exit Sub | |
End If | |
' Password Check | |
If txtPassword.Value = DLookup("Password", "tblEmployees", "[ID]=" & cboUsername.Value) Then | |
MsgBox "Correct Password", vbOKOnly, "Login Successful" | |
Exit Sub | |
Else | |
MsgBox "Incorrect Password! Please try again.", vbExclamation, "Login Failed" | |
txtPassword.SetFocus | |
Exit Sub | |
End If |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment