dlookup based off of mutliple text box values

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

Guest

I have four text boxes on a form (text1 through text4). I would like to have
a fifth textbox called textdetails that displays
information based off a dlookup (display's detail based off of text 1-4
value; whichever textbox currently has focus, dlookup uses this value for
lookup).
How would I go about doing this? Any suggestions?

=DLookUp("[COLOR]","tableCharacteristics","
[tableCharacteristics]![modelname] = '" &
[FORMS]![formX]![VALUEOFCURRENT TEXTBOX 1-4 THAT HAS FOCUS] & "'")

Thanks...
 
I would add an invisible text box txtCurrent and then add code to the On Got
Focus of each of the four text boxes to set the value of txtCurrent to the
value of the focused text box. Then, your DLookup() can reference
txtCurrent.
 
Duane,

Many thanks! Thats what happens when I overthink, I miss the obvious :)
Works like a charm. I appreciate you moving me in the right direction.

Thanks again!


Duane Hookom said:
I would add an invisible text box txtCurrent and then add code to the On Got
Focus of each of the four text boxes to set the value of txtCurrent to the
value of the focused text box. Then, your DLookup() can reference
txtCurrent.

--
Duane Hookom
MS Access MVP


Dave said:
I have four text boxes on a form (text1 through text4). I would like to
have
a fifth textbox called textdetails that displays
information based off a dlookup (display's detail based off of text 1-4
value; whichever textbox currently has focus, dlookup uses this value for
lookup).
How would I go about doing this? Any suggestions?

=DLookUp("[COLOR]","tableCharacteristics","
[tableCharacteristics]![modelname] = '" &
[FORMS]![formX]![VALUEOFCURRENT TEXTBOX 1-4 THAT HAS FOCUS] & "'")

Thanks...
 
Back
Top