From: Josh on
I have a textbox with the following control source:

Code:
=DLookUp("[Heater Type]","Washers","[Model Number] =
LabelModelNumber.caption)"

So basically I am trying to look up the heater type from the washers table
by the model number. On the form I have it so the user select the type of
washer they want and it displays the model number on the form via a label.

It appears to just be grabbing the first item in the heater type field, so
"labelmodelnumber.caption" must be the problem, but I can figure out what I
need to change it too.
From: Daryl S on
Josh -

You need to evaluate the LabelModelNumber.caption outside of the
double-quotes, and add in the single-quote delimeters if it is a text field.
Try this:

=DLookUp("[Heater Type]","Washers","[Model Number] = '" &
LabelModelNumber.caption & "'")

If Model Number is a number field, then use this:

=DLookUp("[Heater Type]","Washers","[Model Number] = " &
LabelModelNumber.caption )

--
Daryl S


"Josh" wrote:

> I have a textbox with the following control source:
>
> Code:
> =DLookUp("[Heater Type]","Washers","[Model Number] =
> LabelModelNumber.caption)"
>
> So basically I am trying to look up the heater type from the washers table
> by the model number. On the form I have it so the user select the type of
> washer they want and it displays the model number on the form via a label.
>
> It appears to just be grabbing the first item in the heater type field, so
> "labelmodelnumber.caption" must be the problem, but I can figure out what I
> need to change it too.