Not sure exactly what you are trying to do here.
Display is a text box or combo or something?
User is supposed to enter their number, and you want to lookup the Employees
table to see if that number is found in the EmployeeID field?
If that's the idea, try something like this:
Dim strWhere As String
strWhere = "EmployeeID = " & Me.Display
If Not IsNull(DLookup("EmployeeID", "Employees", strWhere)) Then
--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users -
http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.
"DS" <bo******@optonline.net> wrote in message
news:27*********************@news4.srv.hcvlny.cv.n et...
Allen Browne wrote:
See:
Getting a value from a table: DLookup()
at:
http://members.iinet.net.au/~allenbrowne/casu-07.html
Hi,
This is what I came up with. Only one problem, it always opens up the
"Invalid ID" form whether I put a valid number in or not. Am I missing
something. Thanks.
DS
If Display = DLookup("EmployeeID", "Employees") Then
DoCmd.RunMacro "Log On"
Else
DoCmd.OpenForm "Invalid ID"
End If