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

Sort By Dates

Status
Not open for further replies.

Glohamar

Programmer
Sep 3, 2003
248
US
I have a form to select criteria (from and to dates, persons, depts) and am giving the user the option to select how they want the report to be sorted, either by a position(format like '018/A1') by drawing(format '1234567') or by date(format '4/19/2004'). All are Ascending. When I select sort by date, how come 1/28/2005 comes before 3/12/2004? What can I do to have 1/28/2005 be at the end?

Thanks for any help

Dave
 
Are your dates stored as text or as true dates??? It sounds like they are ebing stored as text, as this is how text-stored dates will sort because the are sorting based on text rules. You have have the users select date and just change the current date field wherever you are sorting from Date to CDate(Date). The CDate function takes a text value that appears to be a date and converts it to date on the fly for evaluation.

=======================================
People think it must be fun to be a super genius, but they don't realize how hard it is to put up with all the idiots in the world. (Calvin from Calvin And Hobbs)

Robert L. Johnson III
CCNA, CCDA, MCSA, CNA, Net+, A+
w: rljohnso@stewart.com
h: wildmage@tampabay.rr.com
 
Hi mstrmage1768

All of my dates are stored as Dates (Short Date format) even the report is set to Short Date format on the field I want to sort by. What else might be the problem?

Thanks for the help

Dave
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top