Lookup a name in the table based on auto-populated field (1 Viewer)

meiteniite89

New member
Local time
Today, 19:07
Joined
Aug 13, 2020
Messages
23
Hello,

I have created a text box, that automatically draws name of user from system. If I am logged in on my computer it draws my internal company ID. The requirement is to display not just my internal ID, but my name too. I have created a table where I have added all IDs and Names of all users, who will be using this DB. The issue is when I try to use DLookUp to lookup the name in the table based on that auto-populated box I get either #Name? or #Error. I have tried multiple ways, but looks like I am missing something or is it even possible to do?

table Calibrator with columns InternalID, Name
text box on Form CalID, where it uses getUserName function and text box CalibratorName, where I am trying to populated name from table
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 02:07
Joined
May 7, 2009
Messages
19,230
the ControlSource of CalibratorName textbox:

=DLookup("[Name]", "Calibrator", "InternalID = '" & getUserName() & "'") & vbNullString
 

Gasman

Enthusiastic Amateur
Local time
Today, 19:07
Joined
Sep 21, 2011
Messages
14,264
Well the syntax of your Dlookup must be incorrect.?
Show us what you have tried.?

I would try something like
Code:
Me.CalibratorName = DLookUp("[Name]","Calibrator","InternalID = " & Me.CallID)
however Name is a reserved word, so I would change that to UserName or something along those line.?
 

Users who are viewing this thread

Top Bottom