Using Environ with Dlookup

stevefishwickuk

Registered User.
Local time
Today, 08:52
Joined
Apr 6, 2006
Messages
14
Hello,

I am trying to get a text box to populate my users full name.

I have a table with a list of users network names and real names.

The table looks like this:

fldRACF ' Network Name'
fldUserName ' Real Name

What I would like to do is perform a lookup on the table and output the real users name using the identifier taken from Environ("USERNAME").

Currently I am using this code:

=DLookUp("[fldFullName]","tblUsers",[Environ=("USERNAME")])

And placing this code in the 'Control Source' Section.

But it does not work, where am I going wrong?
 
The criteria of your DLookup is not referencing a field in the table.

=DLookup("fldSomeName", "tblSomeTable", "fldSomeField = '" & Environ("UserName") & "'")

Note single quotes enclosing the string returned by the environ function, required if the field fldSomeField is of string type
 
Searching the forum is a great way to discover and learn the answers to your Access progamming questions.

get real user name
 

Users who are viewing this thread

Back
Top Bottom