databasedev.co.uk - database solutions and downloads for microsoft access

Microsoft Access Date Queries

Selecting birthdays within the next 30 days using a Microsoft Access Query:

The following example shows how to create a query in SQL (Structured Query Language) that will select all birthdays that are due to fall in the next 30 days. This example assumes that you have a table named Employees and that this table includes a field named Birthdate.

As usual, there are many ways to perform the same action.

This select statement can be pasted straight into Query By Example sql view but don't forget to change table (Employees) and field name (Birthdate) ...

SELECT Employees.Birthdate,Int((Now()-[birthdate])/365.25) AS Age,
     [Birthdate]+((Int((Now()-[birthdate])/365.25)+1)*365.25) AS NextBirthday, 
     (Int((Now()-[birthdate])/365.25)+1) AS AgeNextBirthday, [Age]+1 AS Next
FROM Employees
WHERE ((([Birthdate]+((Int((Now()-[birthdate])/365.25)+1)*365.25))
     Between Now() And Now()+30));

Run the query to validate your results.