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

Dates not sorting properly 1

Status
Not open for further replies.

crisis2007

Technical User
Apr 2, 2007
114
US
I have a listbox that contains dates from a table. I have the dates listed in descending order but for some reason, it believes that 01/01/2012 should be listed below 12/31/2011. I have MS Access 2003 if that is needed. Any suggestions?
 
You really need to provide the SQL of the Row Source of the list box. It's fairly easy to sort your Row Source by the date descending and much more difficult to sort by a formatted date.
Code:
SELECT MyDateField
FROM MyTable
ORDER BY MyDateField DESC;


Duane
Hook'D on Access
MS Access MVP
 
Also, in the underlying Table, is the Field actually defined as a Date/Time Datatype or as Text?

Linq ;0)>

The Missinglinq

Richmond, Virginia

There's ALWAYS more than one way to skin a cat!
 

for some reason, it believes that 01/01/2012 should be listed below 12/31/2011.
Hmmmm?

Does not 12/31/2011 occur one day BEFORE 01/01/2012?

Conversely, does not 01/01/2012 occur on day AFTER 12/31/2011?

I do not understand your conundrum?


Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
Sorry, I should have posted more information. But Missinglinq's question had me looking back at my table and yes, once again I overlooked the error of setting the field as text rather than date. Thank you!
 
Glad we could help1

The Missinglinq

Richmond, Virginia

There's ALWAYS more than one way to skin a cat!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top