How to Fix Microsoft Access Sorting Formatted Dates in the Wrong Order
Question details
Users need to sort dates correctly in Microsoft Access after the Format() function causes them to sort alphabetically instead of chronologically.

- Product
- Microsoft Access
- Device & OS
- not provided
- Scenario
- Creating database queries or reports that group daily totals and require chronological sorting across different months and years.
- Observed behavior
- When applying the Format() function (e.g., mm-dd-yyyy) in a query, dates are converted to text, causing Access to sort them in alphabetical order rather than by actual date.
Verify that your original field is stored as a Date/Time data type in the Access table design, rather than Short Text, to ensure date logic can be correctly applied.
Sort Queries by the Underlying Date Value Instead of Formatted Text
To achieve proper chronological sorting, group and order your database query using the raw date field or DateValue function, and reserve the Format() function strictly for display purposes.
When the Format() function is used in an Access query, it transforms the Date/Time value into a text string. Consequently, Access evaluates the characters sequentially. For instance, a formatted text date of '01-02-2026' will be sorted before '12-01-2025' purely because the character '0' precedes '1', ruining the chronological sequence.
The most effective way to resolve this is to separate the data logic from the presentation layer within your SQL statement.
Open your Microsoft Access database, navigate to your queries, right-click the query displaying the incorrect sort order, and select 'Design View' or 'SQL View'.
Remove the sorting criteria from the column where you applied the Format() function. Instead, apply the sort to the original Date/Time field.
If you need to group by daily totals without time data, use the expression DateValue([YourDateField]) in your GROUP BY and ORDER BY clauses.
In SQL view, ensure your statement ends with an ORDER BY clause targeting the raw date. For example: ORDER BY DateValue([WorkDate]) DESC;
Keep your formatted field (e.g., Format([WorkDate], 'mm-dd-yyyy')) in the SELECT statement as an aliased column solely so the end-user sees the preferred layout in the query results.

Looking for a Free, Lightweight Office Suite to Analyze Data?
While WPS Office does not include a direct database management equivalent to Microsoft Access, it offers a powerful, free alternative for Word, Excel, and PowerPoint. If you frequently export datasets for analysis, WPS Spreadsheet provides robust, intuitive sorting, filtering, and pivot table features to manage your date fields effortlessly without needing to write SQL queries.
- 1. Download and Install: Visit the official WPS Office website to download and install the free suite on your device.
- 2. Export Access Data: From Microsoft Access, export your table or query results as an Excel Workbook (.xlsx) or CSV file.
- 3. Analyze in WPS Spreadsheet: Open the exported file in WPS Spreadsheet, select your date column, and use the 'Sort & Filter' button to easily arrange dates from oldest to newest.

Frequently Asked Questions
Why do dates from earlier years sometimes appear after recent years in Access?
This happens when your dates are stored or queried as text (often caused by the Format() function). In text-based sorting, Access compares characters from left to right. A string starting with '01' (January) will always sort before '12' (December), regardless of the actual year included at the end of the text.
What is the difference between DateValue() and Format() in MS Access?
DateValue() converts a string or a date/time stamp into a pure Date serial number, which Access natively understands how to calculate and sort chronologically. Format() takes a value and turns it into a specifically styled text string, which is great for visual presentation but terrible for data sorting.
Can I format dates properly without changing my SQL query?
Yes. Instead of using the Format() function within your SQL query, leave the field as a standard Date/Time type in the query. Then, open the Form or Report that uses this query, open the Property Sheet for the specific date text box, and set its 'Format' property to your desired layout (e.g., mm-dd-yyyy).




