Dlookup on report not working

D

Dirty70Bird

Hello, would like to use a Dlookup to import a few fields from a table.
This is the syntax that I'm using:
=DLookUp("[Upper_Limit]","11504","[Test_Number]=0")
Where 11504 is an linked table, Upper_Limit is a field in the 11504 table,
Test_Number is another field in the same table. I get an error message on
the report.
TIA Chris
 
F

fredg

Hello, would like to use a Dlookup to import a few fields from a table.
This is the syntax that I'm using:
=DLookUp("[Upper_Limit]","11504","[Test_Number]=0")
Where 11504 is an linked table, Upper_Limit is a field in the 11504 table,
Test_Number is another field in the same table. I get an error message on
the report.
TIA Chris

1) Make sure the name of this control is not the same as the name of
any field in it's control source. Access get's confused.

2) If the field [Test_Number] is Text datatype, use:
"[Test_Number]='0'")
 
J

John Spencer

I suspect that your table name is the problem. Try surrounding it with [].

=DLookUp("[Upper_Limit]","[11504]","[Test_Number]=0")
 
D

Dirty70Bird

That was it!
adding the ' around the 0 did the trick.

THANK YOU!

fredg said:
Hello, would like to use a Dlookup to import a few fields from a table.
This is the syntax that I'm using:
=DLookUp("[Upper_Limit]","11504","[Test_Number]=0")
Where 11504 is an linked table, Upper_Limit is a field in the 11504 table,
Test_Number is another field in the same table. I get an error message on
the report.
TIA Chris

1) Make sure the name of this control is not the same as the name of
any field in it's control source. Access get's confused.

2) If the field [Test_Number] is Text datatype, use:
"[Test_Number]='0'")
 
Top