Solved Dlookup - wrong result / error (1 Viewer)

ggooss

New member
Local time
Today, 16:36
Joined
Nov 19, 2020
Messages
10
Hello All,

I have an issue with using Dlookup in a query, it is giving the wrong result back. If someone could help please?

Reference Table (all the fields are Short Text):
1641789340571.png


The Dlookup:
Val1: DLookUp("Value128","tblCode128A"," ' 128A=" & [Expr1] & " ' ")

The result (wrong):
1641789515670.png


In the table, the value for Letter A is 33, and the Dlookup returns 16, which is the first value of column [Value128]

What am I missing please?

Thanks a lot
Greg
 

June7

AWF VIP
Local time
Today, 15:36
Joined
Mar 9, 2014
Messages
5,423
Apostrophe is in wrong position in frontof 128A. Field name begins with number (best to avoid that) so enclose field in [ ]. Don't put spaces around apostrophes.

Val1: DLookUp("Value128","tblCode128A","[128A]='" & [Expr1] & "'")

What is Expr1?

What table is query pulling records from?

Why use DLookup? Do these tables have relationship?
 

ggooss

New member
Local time
Today, 16:36
Joined
Nov 19, 2020
Messages
10
Awesome,
This worked:
Val1: DLookUp("Value128","tblCode128A","[128A]='" & [Expr1] & "'")

Thanks a lot June7
 

Users who are viewing this thread

Top Bottom