The Date() function returns the current system date.
A number of built-in functions can be used to make comparisons to dates and other types of data.
To check out some of the possibilities, use the Expression Builder by clicking on the Builder button
The Date function
The Date function is a built-in Access function that returns the current system date, in other words, today's date.
With this versatile function, you never have to hard-code today’s date in your calculations. That is, you can create dynamic calculations that use the current
system date as a variable, giving you a different result every day. In this section, we look at some of the ways you can leverage the Date function to enhance your analysis.
Finding the number of days between today and a past date Imagine that you have to calculate aged receivables.
You need to know the current date to determine how overdue the receivables are. Of course, you could type in the current date by
hand, but that can be cumbersome and prone to error.
To demonstrate how to use the Date function, create the query shown in Figure 2.20.
Using the Date function in a criteria expression
You can use the Date function to fi lter out records by including it in a criteria expression. For example, the query shown in Figure 12.21 will return all records with an order date older than 90 days.
Builder button
, next to the Validation Rule property. You can then work your way through the Expression Builder choices. You can see an example of this by working with the simulation in the lesson.