Others

How to Count Access Records by Date While Ignoring Time

Steven ParkerSteven Parker Oct 29, 2026 870 views

Question details

The user needs to count and group database records by date while ignoring the time portion of a Date/Time field, in order to avoid a data type mismatch error.

How to Count Access Records by Date While Ignoring Time
Product
Microsoft Access
Device & OS
not provided
Scenario
Grouping and aggregating database records based on a Date/Time field using SQL queries.
Observed behavior
Directly grouping by the Date/Time field or improperly applying the DateValue function results in a 'Data type mismatch in criteria expression' error.
Before you start

Verify that your source field is formatted as a true Date/Time data type in your Access table design, rather than a Short Text or Long Text field.

Solution 1Recommended

Use the Int() Function to Extract the Date

The most reliable and efficient way to strip the time from an Access Date/Time field for grouping is by using the Int() function.

In Microsoft Access, Date/Time values are stored as floating-point numbers where the integer portion represents the day and the decimal portion represents the time. Using Int() cleanly removes the time component without causing data type mismatch errors.

1
Open Query Design

Open your Access database, navigate to the Create tab, and click Query Design. Close the Add Tables dialog and switch to SQL View from the bottom right corner or the Home tab.

2
Apply the Int() Function in SELECT

Modify your SELECT statement to wrap your date field with the Int() function. For example: SELECT Int([CollectionDateAndTime]) AS SampleDate.

3
Add Count and GROUP BY

Include your Count function and group by the exact same Int() expression. The final query should look like: SELECT Int([CollectionDateAndTime]) AS SampleDate, Count(*) AS SampleCount FROM Samples GROUP BY Int([CollectionDateAndTime]);

4
Run the Query

Click the Run button (!) in the query design ribbon to view your aggregated records correctly grouped by date.

Use the Int() Function to Extract the Date
Best Practice: Using Int() is mathematically faster for the Access database engine to process than converting dates to strings and back.
Free Microsoft Office alternative

Looking for an Easier Way to Group Data? Try WPS Office

While Microsoft Access handles complex relational queries, most everyday data grouping, counting, and date-filtering tasks can be accomplished effortlessly using advanced spreadsheets. WPS Office offers a free, lightweight, and highly compatible alternative to Microsoft Office, featuring powerful Pivot Tables to group data by date without writing a single line of SQL.

  1. 1. Export and Open Data: Export your Access table as a CSV or XLSX file and open it in WPS Spreadsheets.
  2. 2. Create a Pivot Table: Highlight your data range, go to the Insert tab, and click PivotTable.
  3. 3. Group by Date Easily: Drag your Date/Time field to the Rows area and any other field to Values. Right-click any date cell in the Pivot Table, select Group, and choose Days to instantly ignore the time component.
Fully compatible with Microsoft Excel formats (.xlsx, .xls) and CSV exports from databases.Powerful Pivot Table features allow you to group data by days, months, or years with a simple right-click.Completely free and lightweight, ensuring smooth performance even on low-end computers.Familiar tabbed interface makes transitioning from other office suites seamless with zero learning curve.
microsoft office alternative - wps office

Frequently Asked Questions

Why does DateValue cause a 'Data type mismatch' error in Microsoft Access?

The DateValue function is specifically designed to parse string arguments. When you pass a native Date/Time field directly into it within a GROUP BY clause, Access fails to process the underlying numeric data type correctly, throwing a mismatch error.

How does the Int() function separate the date from the time?

In Microsoft Access, Date/Time values are stored as double-precision floating-point numbers. The integer portion represents the specific date, while the decimal portion represents the time of day. Using Int() drops the decimal, leaving only the date.

Can I group Access records by month instead of exact dates?

Yes. You can use the Format() function to group by month and year. For example, grouping by Format([YourDateField], 'yyyy-mm') will aggregate all records for a specific month, entirely ignoring both the specific day and the time.

How do I check if my field is a Date/Time type and not Text?

Right-click your table in the Navigation Pane and select Design View. Look at the Data Type column next to your field name; it should explicitly say 'Date/Time' or 'Date/Time Extended', not 'Short Text' or 'Long Text'.