Others

How to Calculate the Last Day of Any Month in Microsoft Access

Camila MilosovichCamila Milosovich Oct 28, 2026 869 views

Question details

The user needs to dynamically calculate the last date of a given month and year within a Microsoft Access form or query.

How to Calculate the Last Day of Any Month in Microsoft Access
Product
Microsoft Access
Device & OS
not provided
Scenario
Calculating end-of-month dates using numeric month and year fields in Access forms.
Observed behavior
Requires a robust formula that correctly handles months with varying numbers of days, including leap years and December-to-January rollovers.
Before you start

Verify the exact names of the numeric fields or controls representing the year and month in your Access form or query before applying the calculation formulas.

Solution 1Recommended

Use the DateSerial Function to Return Day Zero

The most efficient way to find the last day of any month in Access is by requesting day 0 of the subsequent month using the DateSerial function.

The DateSerial function creates a date value from specified year, month, and day inputs. By setting the day argument to 0 and adding 1 to the month argument, Access automatically steps backward one day from the 1st of the next month, accurately yielding the last day of the target month.

1
Identify your fields

Determine the numeric fields representing your year and month in your Access database, for example, [yearReporting] and [monthReporting].

2
Apply the DateSerial formula

In your query, control source, or VBA code, enter the expression: DateSerial([yearReporting], [monthReporting] + 1, 0).

3
Calculate for the current date

If you need the last day of the current month based on today's date, use the expression: DateSerial(Year(Date()), Month(Date()) + 1, 0).

Use the DateSerial Function to Return Day Zero
Automatic Rollover Handling: DateSerial automatically handles month values greater than 12. If the current month is December (12), adding 1 makes it 13, which Access correctly interprets as January of the following year.
Free Microsoft Office alternative

Manage Your Data with WPS Office Spreadsheet

While Microsoft Access is a traditional database tool, many data management and date calculation tasks can be handled more easily in a spreadsheet environment. WPS Office provides a free, lightweight, and highly compatible alternative to Microsoft Office, allowing you to perform advanced data analysis with a familiar user interface and seamless migration.

Fully compatible with Microsoft Excel (.xlsx) formats, ensuring your data remains portable.Easily calculate end-of-month dates using built-in EOMONTH and DATE functions without complex database queries.Lightweight application that runs smoothly on Windows, Mac, and Linux.Free to download and use with a highly intuitive, familiar tabbed interface.
microsoft office alternative - wps office

Frequently Asked Questions

Does the DateSerial function account for leap years automatically?

Yes, because DateSerial relies on the system's internal calendar. By requesting day 0 of March, it will correctly return February 29th during a leap year and February 28th in standard years.

Can I use the EOMONTH function in Microsoft Access?

No, the EOMONTH function is native to spreadsheet applications like Excel and WPS Spreadsheet, but it is not built into Microsoft Access. You must use the DateSerial workaround to achieve the same result in Access.

What happens if I pass a month value of 13 to DateSerial?

DateSerial is designed to handle out-of-range values gracefully. A month value of 13 is automatically interpreted as January of the following year, which is why adding 1 to December (12) works seamlessly.