Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to I get my Log In form to work???

Status
Not open for further replies.

MsPeppa

Programmer
Jun 27, 2001
19
0
0
US
Hi everyone...I created a table with the following data...
First Name : Last Name : User Name : Password. I then created a form called "Log In" which has two textboxes, one for the user to enter their User Name, and the other one to enter their Password. There are a couple things I"m trying to accomplish but I am not advanced enough in access to fully understand how to accomplish them. First thing is I want the user to enter their user name and password, and then when they click "Submit" access checks the table to see if their user name exists, and if it does it then checks to make sure their password is correct. If the user name does not exist or the password is incorrect I would like it to shoot out a msgbox saying the user name or password is incorrect. Secondly, I would like users to be able to change their passwords if their logged in (i am going to create another form for changing passwords) If anyone has any tips/code that would be much appreciated... Thank you
 
Well, as for the username/pw lookup,

Assuming you have a table that looks like this:

tblUsers:
Username
Password

Private Sub cmdLogIn_Click()
If DLookup("[Password]", "tblUsers", "[Username]='" & Me.txtUserName & "'") = Me.txtPassword Then
' User logged in; do something
Else
MsgBox ("Not a valid username/password combination.")
End If

End Sub

As for changing the password, I'd make a form that's bound to tblusers, and disallow deletions/additions, allow edits, and filter it to only show records for the current user (so the user can only change their own passwords).

hth
James
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top