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

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
 
D

Douglas J. Steele

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
Blank Fields in Report 2
DLookup 4
Dlookup condition result 4
codes with FILTER 10
Date and Total 1
Updating Form Field From Another Table 3
dlookup 2

Top