query bound to combo box doesn't sort correctly

  • Thread starter Thread starter epigram
  • Start date Start date
E

epigram

I'm maintaining an Access app that was written by someone we no longer can
contact. I have a form that contains a combo box that has a query
associated with it. The query is the Row Source property for the combo box.
The query is quite simple in that it selects two columns (1 column each from
two tables via a join) and sorts on one of the selected columns. I need to
change the ORDER BY clause. I have changed the query by adding a third
column (that is in one of the two tables) to the SELECT clause and then
changed the ORDER BY clause to sort by that column. When I run/test the
query in the Query Builder it sorts correctly. When I use the combo box the
query seems to still sort in the old way. I've closed down (and saved) the
form and this still happens when I bring it back up. Althoug, if I go into
Query Builder for the combo box's query/Row Source it still runs correctly.
Is there something else that I need to change? Is there something else that
could be affecting the sort order?

Thanks.
 
Is there any code that could be setting the RowSource property at runtime?
If so, it could be overwriting the RowSource you entered and saved manually.
To find out, open the immediate pane of the visual basic editor when the form
is open and check the value of the property

?Forms!myForm!myComboControl.RowSource

That's all I can think of off hand. good luck.
 
It doesn't appear the RowSource for the combo box is being overwritten.
When I update this property via the Properties Page/Query Builder it shows
up correctly in the Immediate Window. The Immediate Window is a great tool
for this. I wasn't aware of using it in this way. Thanks for the tip!

Any other ideas on what could be affecting the sort order?

Thanks.
 
Right click on the form and look at the properties. ON the DATA tab should
be an "Oder By'" item. Change that, too.
HTH
 
Back
Top