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

Show all results in a combo box on form

Status
Not open for further replies.

KevinMCG

MIS
Nov 26, 2003
8
US
I have a Combo box on a form that is linked to Customerid
can i show more than one column in a combo box?

I am looking to show custid,firstname,lastname,cellphone

kevin


 
Change the following properties of your combo:
ColumnCount = 4
RowSourceType = "Table/Query"
RowSource = "SELECT custid,firstname,lastname,cellphone FROM yourTable ORDER BY lastname"
You may have to adjust the ColumnWidths.



Hope This Help, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
I am sorry ....
I should have been more specific in my thread
I had already set the Column and sizes in the combo box but after client makes selection he wants all the columns to show up not just the first "Bound" column which is the custid in this case. He would like to see all the columns show up on the form as
"IDC12345|Joe|Blow|555-555-1234"

I think i am barking up a tree. I think i am better off having text boxes to show on form when related record is selected from combo box.

Any suggestions.


 
Kevin

My preferred work-around solution would be to display the contents in an unbound text field. You will have to use the column property of the combo box query for this to work.

This not often used property works like this...

me.YourCombBox.Column(n)

Where n is an index number from 0 to (number of columns retrieved in you query)-1.

Me.YourUnboundTxtFld = me.YourCombBox.Column(0) & " " & me.YourCombBox.Column(1) & " " & me.YourCombBox.Column(3)

I am not too sure about displaying this string back in the combo box, but I supposed you can hide the combo box and display the text field on top. Later, hide the text field and display the combo box.

Probably a cleaner solution would be to display the primary column in the combo box, and the remaining columns in the unbound text field which would reside underneath or to the left of the combo box.

Richard
 
willir

As another strategy, I place a small subform on the form that is linked to the bound field in the combo box.

Your solution of having two or more combo boxes is good too. If done in a certain way, it allows the end user to retrieve the same record by different mthods -- more user friendly -- retrieve info by last name or by phone number.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top