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

Sorting A Combo Box thru Code

Status
Not open for further replies.

CharlieT302

Instructor
Joined
Mar 17, 2005
Messages
406
Location
US
I have two combo boxes. If the selection in the first combo box is: "No Preference" I would like the values of a second combo box to sort on a particular field. Otherwise, I want it to sort on another field.

Any Ideas?

Thanks
 
Rewrite the RowSource SQL code of the second combo in the AfterUpdate event procedure of the first combo, with the desired ORDER BY clause.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
That sounds logical, but the RowSource knows which box to sort based upon the fact that it is attached to the desired combo box.

How do I get the AfterUpdate event of the first combo box to know which combo box to sort?

[Combo2] = ?

Thanks
 
I can copy the RowSource over to the AfterUpdate Event, but do not see how to construct the command.
 
Nevermind, I got it to work just fine.

Me![Combo2].RowSource = "MyComboboxRowSource"

Thanks much.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top