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

Combo box to show two fields

Status
Not open for further replies.

Telsa

Programmer
Jun 20, 2000
393
US
I have a combo box that is bound to an autonumber field.

I have it showing one field... but I want it to show two fields... and I don't mean when you click the drop down for the listing... I want it to be shown on the screen when the selection is made but the bound still be the autonumber field.

Can anyone clue me in????

Mary :)
 
You could add a second box that has a recordsource that is a dlookup

=dlookup("value2","tbl_combo_box_values", "value1 = '" & me.combobox & "'")
Mike Rohde
rohdem@marshallengines.com
 
The combo box has a number of properties which can be used to accomplish what you want. These include the row source type, row source, column count, column widths, bound column, list width, width properties. These can all be set in code if desired but for your application it sounds best to set them in design mode.

For Access 97:
Set the Row Source Type to Table/Query

Set the Row Source to your SQL statement such as 'SELECT autonumberfield FROM tblMyTable'.

Set the column count to the number of columns you want the combo box to control. Each column can be referenced in code with for example: Me.MyCombo.Column(0) in the AfterUpdate event or other code.

Set the Column Width to the width in inches for example: 1;0 would show the first column and hide the second. But the second column could still be referenced as Me.MyCombo.Column(1) in the code.

Set the Bound Column to whatever the column for the autonumber field

Set the List Width to the size of the list width you want displayed. This should be the combined sizes of all columns which are to be displayed using the combo box.

Set the Width to the width of the combo box itself.

Sometimes it takes a while to tune it properly but it is well worth the effort.
 
well, I have a subform showing me everything... just don't want to make it disconcernting to look at the combo box and see just the one field (which is an apartment number). Wanted show both apt number and street address.

Thanks anyway...

Mary :)
 
Try this,.
Go in to properties on the combo box, then to column widths set the first one to .5” in stead of 0.

Hope this helps
Good luck and may God bless.
 
That didn't work... no matter what width's I put in for each field, only the first one shows up, the remaining do not.

Hmmmm.... there has to be a way, don't you think???

Mary :)
 
The dlookup function that I described earlier in this thread will work for what you are trying to do. If you have an apartment number in your combo box, create another text box right next to it that looks up the street address. If you set the recordsource to =dlookup("blah,blah"), it will update each time you change the combo box. If you want it to look like it is a single combo box, put the other text box right next to it. The user will never know the difference (or care).
Mike Rohde
rohdem@marshallengines.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top