Dlookup not working properly

  • Thread starter Thread starter Anthony Smith
  • Start date Start date
A

Anthony Smith

Good Afternoon,

Happy, Safe & Blessed New Year to Everyone!

We have an Access 2003 application with SQL 2000 server on the backend. I
recently added another table into our SQL database and linked it into
Access. I'm trying to run a Dlookup statement to pull a price from the new
table based on the product id(part#) but it returns a null or empty field.
Can anyone advise? See below:

Quo!UnitPrice = DLookup("[PECOCost]", "dbo_PartsDiscount", "[ProductID] ="
& [Quo]![ProductID])


I do not get an error message, it just doesn't return a value. Any ideas?
Thanks!

Sincerely,
Anthony Smith

In God We Trust!
 
Hi Anthony,

If the field "ProductID" is defined as text field, then you have to put
quotes around them.

Quo!UnitPrice = DLookup("[PECOCost]", "dbo_PartsDiscount", "[ProductID] ='"
& [Quo]![ProductID] & "'")
 
Yes it is a text field. Thanks for the help, it works! Have a blessed day!
JL said:
Hi Anthony,

If the field "ProductID" is defined as text field, then you have to put
quotes around them.

Quo!UnitPrice = DLookup("[PECOCost]", "dbo_PartsDiscount", "[ProductID]
='"
& [Quo]![ProductID] & "'")


Anthony Smith said:
Good Afternoon,

Happy, Safe & Blessed New Year to Everyone!

We have an Access 2003 application with SQL 2000 server on the backend. I
recently added another table into our SQL database and linked it into
Access. I'm trying to run a Dlookup statement to pull a price from the
new
table based on the product id(part#) but it returns a null or empty
field.
Can anyone advise? See below:

Quo!UnitPrice = DLookup("[PECOCost]", "dbo_PartsDiscount", "[ProductID]
="
& [Quo]![ProductID])


I do not get an error message, it just doesn't return a value. Any ideas?
Thanks!

Sincerely,
Anthony Smith

In God We Trust!
 
Back
Top