General discussion


Microsoft access Security Question

By Zachary.Diamond ·
I am trying to keep users from getting into a certain form in a database. Here is the code so far. I don't know how to close it out if the password fails.
Sub Logon()
'Variable Declaration Section
Dim Username
Dim Password
Dim qresult1
Dim qresult2
'Variable Definition Section
Username = InputBox( _
"Welcome to Citi Commerce Solution Employee Resolution." & _
Chr(13) & Chr(13) & _
"Please enter your username.")
Password = InputBox( _
"You're doing a great job!" & _
Chr(13) & Chr(13) & _
"Now, please enter your password")
'Query Execution Section
qresult1 = DLookup("[Username]", "FirstTable", "[Username] = username")
qresult2 = DLookup("[Password]", "FirstTable", "[Password] = password")
'Processing Logic Section
If Username = qresult1 And Password = qresult2 Then
MsgBox "Congratulations, Please Enter Information!", vbOKOnly
MsgBox "Hey! That's not right!" & Chr(13) & "Please retype Password!", vbRetryCancel
End If
End Sub

This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Comments

Related Discussions

Related Forums