Username & password problem

K

kristie ann

Hey,

I am creating a login system where a user can register only if the
username entered matches a list of usernames in the database. They are
then required to enter a password and retype a password to register.
The main problem Im having is making sure that the username entered
matches that in the database. Also I need to make sure that the
password field in the database is empty, if not then they are an
existing user.... Please if anyone has some code that would help me
with my problem that would be great...Thanks
 
M

Miranda

hey, maybe this will help. This is some code that i used for my login page.
Where accessPage is the login form with usernameEntered and passwordEntered
being the values the user typed and mainpage1 is the form that is loaded if
the login details are correct.

Private Sub OK_Click()
On Error GoTo Err_OK_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "mainpage1"

If DCount("[userID]", "users", "[userID] = '" &
Forms!accesspage!usernameEntered & _
"' AND [password]= '" & Forms!accesspage!passwordEntered & "'") > 0 _
Then
DoCmd.OpenForm stDocName, , , stLinkCriteria
DoCmd.Close acForm, "accesspage", acSaveYes
Else

End If

Exit_OK_Click:
Exit Sub

Err_OK_Click:
MsgBox Err.Description
Resume Exit_OK_Click

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top