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!

Combo box sorting problem

Status
Not open for further replies.

gransbpa

Programmer
Jun 5, 2001
98
NL
Hi there,

I have a combo box with it's rowsource based on a database table. This table has an ID (key-field), a number which is an identifier for the user and a description. I only want the combobox to show the identifier (not the ID) and the description, and I want to sort the combobox on the identifier. But whatever I try, the combobox keeps sorting on ID. Even when I make an intermediate query on the database table which does not contain the ID, and assign this query as the combobox's datasource, it still keeps sorting on the ID, although the data in the combo - wizard screen are shown sorted correctly! Does anyone know what causes these strange things to happen?

Thanks.
 
once you have created the combo box using the wizard, can into the query behind the combo box, which is the row source property. and sort on the field you wish.

To not have the ID display, you should notice in the Column Width property there is 3 value, make the first 1 = 0.

I hope this helps, any issues let me know.
 
Set the RowSource property of the combo to something like this:
SELECT identifier,description FROM yourTable ORDER BY 1

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Hi PHV, M8KWR. The problem has already been solved: I found out that someone else before me had reset the rowsource in VBA on the form open event: so, the rowsource property was overwritten every time the form opened. I had not considered this possibility, sorry for bothering you with this one, but thanks anyway.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top