Discussion Locked

Microsoft access Security Question

0 helpful
1 reply
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

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
Else
MsgBox "Hey! That's not right!" & Chr(13) & "Please retype Password!", vbRetryCancel
End If
End Sub

1 reply

by chris a

I am not sure of the code of the top of my head but if you make a new form make new button start wizard and select Application Quit. It will create the code to close Access.

Chris Allen

This discussion is closed to new replies.