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)
--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)
"AngieM" <(E-Mail Removed)> wrote in message
news:12A4AB2F-6397-4028-B483-(E-Mail Removed)...
>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