Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dlookup Value in a Combo Box 1

Status
Not open for further replies.

pdldavis

Technical User
Oct 29, 2001
522
US
Hi, I'm having trouble getting the syntax correct for looking up a value in a combo box. There is one bound column and two other fields. I am interested in displaying one of the other columns in a text box on the same form in a different area.

I think the text box control source should be something like <=dlookup(&quot;[desc]&quot;,&quot;[combobox]&quot;)> where the field [desc] is one of the unbound fields contained in the combo box and [combobox] is the control that has the field. Or is dlookup the correct function to use?

Any help would be appreciated. Thanks.
 
DLookUp pulls a value directly from a table or saved query.

If I understand your goal here, you should be able to referenmce the other columns of the combobox on the combobox's BeforeUpdate event with the following.
Code:
TextBoxName = ComboBoxName.Column(2)

Be aware that the first column in a combobox is numbered zero. Also, the column in the combobox that you reference doesn't have to be visible. You can set the column's width property to 0&quot; and still reference it for display elsewhere.


HTH
John

Use what you have,
Learn what you can,
Create what you need.
 
Thanks for the help. It solved my problem. I did not know that the first column was '0' either. Solves a few mysteries too.
Thanks, Dan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top