Individual passwords

  • Thread starter Thread starter RGFlade
  • Start date Start date
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.
 
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
 
Back
Top