If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
How do I use dlookup in a form to find a specific field
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. |
#2
|
|||
|
|||
How do I use dlookup in a form to find a specific field
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. |
Thread Tools | |
Display Modes | |
|
|