Dlookups ................!

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have been trawling this board and the net generally but seem to be getting
nowhere so hope you can help.

I have a table called Products with 2 fields ProductCode (numeric) and
Product Name (text).

I have a form with a field StockCodeGroup (numeric the same as ProductCode).

In a text box i am tring to use a Dlookup as follows to return the product
name

DLOOKUP("[Product Name]","[Products]","[ProductCode]=Form!"[StockCodeGroup]")

I just result in a #Name? error

Can anyone tell me what i'm doing wrong or if i'm even vaguely on the right
track...

I didnt create the database and have little knowledge so any help gratefully
recieved.

Thank you

Angie x
 
If this is on the form where StockCodeGroup exists, try:

DLOOKUP("[Product Name]","[Products]","[ProductCode]=" &
Me![StockCodeGroup])

That assumes ProductCode is a numeric field. If it's text, try:

DLOOKUP("[Product Name]","[Products]","[ProductCode]=""" &
Me![StockCodeGroup] & """")

or

DLOOKUP("[Product Name]","[Products]","[ProductCode]='" &
Me![StockCodeGroup] & "'")

(I the first case, that's 3 double quotes in a row before the control name,
and 4 double quotes in a row after it. In the second case, it's single
quote-double quote before the control name, and double quote-single
quote-double quote after it.)

If you're trying to do this elsewhere, replace Me![StockCodeGroup] with
Forms!<NameOfForm>![StockCodeGroup] (replace <NameOfForm> with the name of
the form. If there are spaces in the form name, put square brackets around
it)
 

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

Similar Threads

Dlookup not working 2
DLookup 4
Blank Fields in Report 2
Like within IIf 10
dlookup 2
table based i one field splitted in 2 fields 6
Dlookup condition result 4
Replacement of old product codes 4

Back
Top