using dlookup

G

gary verno

can not get dlookup statement syntax correct

A form collects cboUsername and Password and compares it
using dlookup against UserName and orgPassword text
fileds in tblLogin.

If Me.txtPassword.Value = DLookup
("[orgPassword]", "tblLogin", "UserName= '" &
Me.cboUserName.Value & "'") Then

LoginID = Me.cboUserName.Value

Any suggestions?
 
K

Ken Snell

Remove the [ ] from the first argument and then try it again.

If Me.txtPassword.Value = DLookup("orgPassword", "tblLogin", "UserName= '" &
Me.cboUserName.Value & "'") Then
 
R

Rick Brandt

gary verno said:
can not get dlookup statement syntax correct

A form collects cboUsername and Password and compares it
using dlookup against UserName and orgPassword text
fileds in tblLogin.

If Me.txtPassword.Value = DLookup
("[orgPassword]", "tblLogin", "UserName= '" &
Me.cboUserName.Value & "'") Then

LoginID = Me.cboUserName.Value

Any suggestions?

Assuming you don't have this on multiple lines in your code window it looks OK
to me. If it is on multiple lines you would need line continuation
characters(_).
 
Top