Link to home
Start Free TrialLog in
Avatar of jaw0807
jaw0807Flag for United States of America

asked on

SELECT DISTINCT statement suddenly not sorting automatically as per usual.

I have an Access 2003 application that contains linked SQL2000 tables and a lot of VBA code automation.  I deployed it 2 weeks ago before going on vacation and when I returned yesterday was told that about 2 days ago (while I was still out) it had spontaneously begun losing some of the functionality and exhibiting odd quirks, among them a combo box for which the row source query is a SELECT DISTINCT statement had suddenly started showing up unsorted, which I have never seen before.  I can of course specify an ascending sort but have never before had to do so.  Nothing has changed with the back end SQL database or the Access interface.  The possible changes are automatic MS patches or possible local security changes  (we have been 'consolidated' and aren't usually notified of such changes anymore).  
Among a group of 5 users, these problems are not presenting in the same combinations from user to user and cropped up at different times from some users.  


In particular, can anyone think of what might have caused a SELECT DISTINCT result to suddenly stop sorting itself by default?  I'm wondering if something could be generally preventing Office2003/VBA/ODBC  from performing normally, and if I had an idea of what could be causing the un-sort, that would be a start.

Thanks for any ideas.  
ASKER CERTIFIED SOLUTION
Avatar of Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3]
Flag of Luxembourg image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jaw0807

ASKER


As I say, I know that I can explicitly tell the select distinct query to sort.  What I have never seen is a select distinct result set, that had been reliably returning a sorted result for over a week without that explicit instruction, to suddenly (in the middle of a workday) start returning an unsorted result.  On another note, I have never personally seen a select distinct query NOT return a sorted result set, so this is very odd to my experience.

Let me re-emphasize that this question is more about ferreting out what could have caused this (and the other problems) to suddenly spring up in a seemingly random manner than it is about the select distinct list itself.   Again, we are no longer in control of (or necessarily notified of) changes to the user machines and I am trying to figure out what Unkowns could be at work here so that I can ask The New Overlords specific questions about what might have changed, since just asking them "what's changed" doesn't get a very useful result.

"what changed" , well, that is purely a matter of a threshold, as from when the engine processes a query in eventually a different way.
DISTINCT will internally create a temporary table of the values to be "DISTINCT", but as from a certain moment on, the way to do that might change a little bit.
Avatar of bamboo7431
bamboo7431

I had a similar problem when I upgraded an application from Access to SQL Server. In Access, GROUP BY would automatically sort. In SQL Server, you had to throw in an ORDER BY clause.
Forced accept.

Computer101
EE Admin