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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Seperate Value & Code for Combo box

Status
Not open for further replies.

shangrilla

Programmer
Nov 21, 2001
360
0
0
US
Hi:

Table with 2 columns

KeyValue DisplayValue
1 Tables
2 Chairs
.
.

Can I have a combo box in which the display value is 'Tables, Chairs...', but the code to look up these values is '1,2...'?
 

If you set the BoundColumn to 1, the Value property of the combobox will return the first field value, if you set the BoundColumn to 2, the Value property will return the second field value.

Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
sure you can, try this

put this code in the interactivechange of your combo box

MESSAGEBOX(ALLTRIM(STR(This.ListIndex)))
 
One thing you have to understand about combos, the textbox portion will display whatever is in the first column of your RowSource, so if you want the DisplayValue shown, you need the RowSource to be RowSource, KeyValue. You'll want to set the combo's BoundTo to .T. if the bound column (Column2) is numeric. Then you can set the ControlSource to be the foreign key field in the table you want to store the returned value in.


-BP (Barbara Peisch)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top