A combo box to show four fields

tomchance

New member
Local time
Today, 12:09
Joined
Nov 27, 2006
Messages
3
I have a form with a combo box to select which building a customer is in. Here's the data:

Customer
Building

Buildings
ID
streetNameNumber
address
champion
dayofweek

At the moment I have it set-up so that the combo box shows the streetNameNumber and address columns when you drop it down, and it saves the ID to the Building field in the related table. I would like to:

  1. Have both the streetNameNumber and address field values show when the combo box is inactive (currently it only shows the address field)
  2. Either put the champion and dayofweek fields into the combo box, or (as that would get pretty huge) have the champion and dayofweek fields into text fields below that show the appropriate data and update when the combo box changes

I've looked at a book on Access but it's not much help, and browsing around hasn't made me any wiser either. I'm doing this all through the UI and haven't done any Access programming before, but I'm familiar with Perl/Python/etc. so I'm quite happy to get my hands dirty if someone is willing to guide me through it...
 
You can drive your combo with a rowsource query that joins fields before displaying them, something like...
Code:
"SELECT ID, StreetNameNumber & ' ' & Address AS StreetAddress, Champion, DOW " & _
"FROM Buildings;"
Now, if the name of your combo is cboOne, then you can display a hidden combo column value in a textbox by setting the controlsource of the text box to something like...
Code:
"=cboOne.Column(2)"
which, indexed from zero, references the third member of the "Column" collection of the combo.
You may also need to set the columncount and columnwidths properties of the combo. Find them on the format tab of the combo property sheet.
Cheers,
 

Users who are viewing this thread

Back
Top Bottom