Individual passwords

R

RGFlade

I would say I'm an advanced beginner. . .

I have a database of employees. I want only the employee
to be able to update their record. So in the Employee
database I have their ES No (7 digit text) and Password
(20 digit text). I have this formula:

If (DLookup("[Password]", "Employees", "[ES No] =" &
Me.TxtBoxESNo) = Me.TxtBoxPassword) Then
DoCmd.RunMacro "OpenPassword"
Else
MsgBox "Incorrect Password. Please Try Again."
End If

but when I run this I get:

Run-time error '3464':
Data type mismatch in criteria expression

Any ideas?

Thanks for any help.
 
T

tina

text values have to be bracketed by single quotes. try

If (DLookup("[Password]", "Employees", "[ES No] ='" &
Me.TxtBoxESNo & "'") = Me.TxtBoxPassword) Then
DoCmd.RunMacro "OpenPassword"
Else
MsgBox "Incorrect Password. Please Try Again."
End If

presumably the line break in the DLookup function is not included in your
original code. if it is, you need to include a line break symbol (space,
underscore).

hth
 

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