Update a User ID Field

D

Duncs

I have a table with LogonID & UserName, and I want to populate a field
on my form with the User Name of the agent who is logged in.

I've used the code from Dev Ashish to get the logon ID however, what
I'm stuck at is how to populate the agents name field on the form,
with the UserName from the table based on the LogonID.

Make sense?

Can anyone help?

TIA

Duncs
 
R

RonaldoOneNil

If LoginID is Text set controlsource of your username field to
=DLookup("[UserName]","TableName","[LoginID] = '" & Me.LoginID & "'")

If LoginID is numeric
=DLookup("[UserName]","TableName","[LoginID] = " & Me.LoginID)
 
Top