Administrator: Receipts Page 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26

Make a Date

DateDiff finds the difference between two dates. Microsoft Access uses Now() for the current date. The code looks like this:

 

DaysRented: DateDiff("d",[DateRented],Now())

 

Where DaysRented is a Label

DataDiff() 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”

 

Try it: Calculate the Date

Open rptCustomerReceiptSQ in Design View.

Insert a new column into your query.

Type the DateDiff code:

DaysRented: DateDiff("d",[DateRented],Now())

 

Test your results and Save the query.

Home ->View ->Query Design