Dlookup not working properly

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!
 
G

Guest

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] & "'")
 
A

Anthony Smith

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!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top