Calculate the Date
Difference
Many
businesses need to calculate the difference between two dates.
Microsoft Access
uses a
DateDiff() function. It goes like this:
DaysRented:
DateDiff("d",[DateRented],Now ())
Where
DaysRented is the Alias,
DateDiff()
is the function,
"d" is the
time interval,
[DateRented]
is a field in tblMovieRented.
Other
DateDiff intervals are:
Month |
"m" |
Year |
"yyyy" |
Week |
"ww" |
Hour |
"h" |
Minutes |
"n" |
4.
Try it: Create a Calculated Field
Click on a
blank Field in the QBE Grid.
Right
click to Zoom. Enter the Expression:
DaysRented:
DateDiff("d",[DateRented],Now ())
Click
OK. Keep
going, please.