simple question regarding Dlookup

newbee1

New member
Local time
Today, 21:52
Joined
Jan 17, 2012
Messages
5
Hey,im sorry to turn this around but i have a simple question.Im currently working on a login form.ive got the code i want to validate the id,email adress and password of a user using DLookup.but the trouble is ,after it validates it adds the entered data into the table! so in the end I have 2 of the same records in the database.Is this a common problem?here is my code.Its pretty simple.
Private Sub cmd1_Click()

If (DLookup("Password", "table1", _
"[ID]=" & Me.txtid.Value)) > 0 Then

'Close logon form and open splash screen

DoCmd.Close acForm, "f1"
DoCmd.OpenForm "f2"

Else
MsgBox "Password Invalid. Please Try Again", vbOKOnly, _
"Invalid Entry!"
Me.Password.SetFocus
End If


End Sub
 
Please post the entire sub. This is only a snippet.

What do you think this DLookup is doing?
 
Im sorry.This is the code.Im very new to this.All im trying to do is to validate the id,password and email address that the user enters on a login form.

If Me.Password.Value = DLookup("Password", "table1", _
"[ID]=" & Me.txtid.Value) Then

'Close login form and open another form.

DoCmd.Close acForm, "f1"
DoCmd.OpenForm "f2"

Else
MsgBox "Password Invalid. Please Try Again", vbOKOnly, _
"Invalid Entry!"
Me.Password.SetFocus
End If
 

Users who are viewing this thread

Back
Top Bottom