View Full Version : Total Days in a Parameter


rkrause
03-06-2009, 04:19 AM
When a desired user is running a report they get 2 pop up boxes for a date range. Is there a way to figure out how many days are in that range. example if they put 2-1-09 and 2-28-09 thats 28 days. I want a seperate Txt box to display the total days. So for this month my textbox would display 28. Please help thank.

raskew
03-06-2009, 04:29 AM
Look up the DateDiff() function in the help file.

Bob

P.S. To show inclusive dates you'll need to add 1 day to the result since datediff("d", #2/1/09#, #2/28/09#) will return 27, not 28.

rkrause
03-06-2009, 04:58 AM
=datediff(d,[Enter a Start Date],[Enter an Ending Date])

Thats what i tried using. But i got an error, and it prompted me for another parameter. The dates in Brackets are my parameters that i use when the report is being run.

raskew
03-06-2009, 05:07 AM
You'll need to use quotes, e.g. "d" versus d.

Bob

rkrause
03-06-2009, 05:08 AM
I didnt see your PS on the bottom I got it. THanks alot!!!

raskew
03-06-2009, 05:15 AM
You're most welcome.

Bob

rkrause
03-06-2009, 05:44 AM
I guess i have another question. For the dates, how do i use the parameters that i use. I am not always going to run this report for just February.

raskew
03-06-2009, 05:56 AM
You need to create a calculated field in your query, e.g.:

MyTot: datediff("d",[Enter a Start Date],[Enter an Ending Date]) + 1

The above has nothing to do with February in particular, but instead is dependent on your Start and End Dates.

You really need to take a look at the Help File and the accompanying example(s).

Bob