"DS" wrote
This code almost works, The only
problem, is that it always Opens the
"Invalid ID" form whether the ID is
valid or not, what am I doing wrong?
If Display = DLookup("EmployeeID", "Employees") Then
DoCmd.RunMacro "Log On"
Else
DoCmd.OpenForm "Invalid ID"
End If
DLookup, unless you include a criteria, will always return the "EmployeeID"
of the first record physically stored in "Employees". If that is not what is
in [variable|Control|?] Display, you will very correctly open the
"InvalidID" form.
Clarify by explaining what is Display, how does a value get there, and how
you thought you were selecting a record in "Employees", and perhaps someone
can offer suggestions.
If you expected this to be appended to an existing thread, it wasn't, and
those details are not obvious to me.
Larry Linson
Microsoft Access MVP