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

combo box afterupdate

Status
Not open for further replies.

Bobnz

IS-IT--Management
Aug 19, 2002
116
0
0
NZ
Hi, I have a combo box based on a query that displays all values from 2 fields (where category = foo). The user selects
the value they want however at this point only the second column value disappears, I want both columns to display.
Is this possible?

B
 
Use the Column(index) number to display the results... example for a combobox having two fields, LastName and FirstName...
LastName would be Column(0) and FirstName would be Column(1)
... to use in a messagebox.. the code would be similar to

msgbox "LastName is " & cboName.Column(0) & " And FirstName is " & cboName.Column(1)

PaulF
 
If your combobox has one or more columns hidden, upon leaving the combobox, only the column(s) you don't have hidden will be displayed.

If, on the other hand, you need/want to hide one of the columns you can show the other column in a text box. For example, if you are displaying the LastName in the combobox (column(0)), then set the control source property of the text box equal to =cboName.column(1)
 
Thanks for the replies, I am populating the combo boxes from a query in the properties data tab rowsource field.

both fields show when the combo box is opened but once the user chooses only the first field shows.
fld1 fld2
fooA foo1
fooB foo2

user selects: fooA
combo shows: fooA
not: fooA foo2

B
 
Hello,

In the query for your combo box add an additional field with the following info.

Expr1: [tblname].[fld1]&"_"&[tblname].[fld2]

Then in the format tab of the properties box for the combo box change the Column Count to 3 and you Column widths to 0cm;0cm;5cm

Your combo box display during selection and after should read like this:

While Selecting

fooA foo1
fooB foo2

After Selected

fooA foo1

Cheers

Destiny Is Not The Chances We Take, But The Descisions We Make.
 
Nice one matethreat, thanks for that.

B
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top