DLookup (1 Viewer)

Dumferling

Member
Local time
Today, 07:12
Joined
Apr 28, 2020
Messages
102
I cannot see what is wrong with this: vblUpdatedBy = DLookup("[FullName]", "tblAUsers", vblUser)

The variable (vblUser) is defined as a String and picks up its value from a function (fOSUser) which give the username. It has this correctly as DKNIGHT (text). The DLookup function is finding the full name of the user (FullName) in tblAUser but it produces an error 2471 The expression you entered as a parameter produced this error: "DKNIGHT".

I can't see what the issue could be
 

Isaac

Lifelong Learner
Local time
Yesterday, 22:12
Joined
Mar 14, 2017
Messages
8,777
Try: = DLookup("[FullName]", "tblAUsers", "UsernameColumnName='" & vblUser & "'")
 

Minty

AWF VIP
Local time
Today, 06:12
Joined
Jul 26, 2013
Messages
10,371
See the examples in my signature but you aren't comparing your vblUser to anything

vblUpdatedBy = DLookup("[FullName]", "tblAUsers","YourUserColumnNameGoesHere = '" & vblUser & "'")

Edit - damn faster fingers.... @pisorsisaac@gmail.co
 

Dumferling

Member
Local time
Today, 07:12
Joined
Apr 28, 2020
Messages
102
Great. So I need to tell it which column to look in. Works now. Thanks very much
 

Isaac

Lifelong Learner
Local time
Yesterday, 22:12
Joined
Mar 14, 2017
Messages
8,777
Minty and I were glad to help, good luck with your project.
 

Users who are viewing this thread

Top Bottom