Difference between 2 dates

T

Tandy

Right now I have an annual report with a text box that has "=Format$([Type
Start Date],"mmmm d"", ""yyyy",0,0) & " through " & Format$([Type End
Date],"mmmm d"", ""yyyy",0,0)" for its control source. I would like the
difference between the [Type End Date] and [Type Start Date] to be displayed
in a different text box. I know this is fairly simple, but I just can't seem
to get it to work. All help would be greatly appreciated!

Tandy
 
K

Ken Snell [MVP]

Use a control source expression similar to this in that other textbox:

=DateDiff("d", [Type Start Date], [Type End Date])
 
T

Tandy

Ken and Duane,

Thank you for the formula, but I need a little more help. I actually to
have the formula count the number of days between the Start Date and End
Date. Example, if the Start Date is 5/1/2005 and the End Date is 5/5/2005,
you formula gives me 4 when I actually need 5. So I added a "+ 1" on the end
of the formula. The promblem now is I need to times the 5 by 24 to get the
hours and when I try to do that it won't let me. Sorry to bother you again,
but I really appreciate the help!

Tandy
 
R

Rick Brandt

Tandy said:
Ken and Duane,

Thank you for the formula, but I need a little more help. I
actually to have the formula count the number of days between the
Start Date and End Date. Example, if the Start Date is 5/1/2005 and
the End Date is 5/5/2005, you formula gives me 4 when I actually need
5. So I added a "+ 1" on the end of the formula. The promblem now is
I need to times the 5 by 24 to get the hours and when I try to do
that it won't let me. Sorry to bother you again, but I really
appreciate the help!

Tandy

Then just use...

DateDiff("h", [Type Start Date], [Type End Date])
 
K

Ken Snell [MVP]

or

=(DateDiff("d", [Type Start Date], [Type End Date])+1)*24

or

=DateDiff("h", [Type Start Date], [Type End Date])+24


--

Ken Snell
<MS ACCESS MVP>

Rick Brandt said:
Tandy said:
Ken and Duane,

Thank you for the formula, but I need a little more help. I
actually to have the formula count the number of days between the
Start Date and End Date. Example, if the Start Date is 5/1/2005 and
the End Date is 5/5/2005, you formula gives me 4 when I actually need
5. So I added a "+ 1" on the end of the formula. The promblem now is
I need to times the 5 by 24 to get the hours and when I try to do
that it won't let me. Sorry to bother you again, but I really
appreciate the help!

Tandy

Then just use...

DateDiff("h", [Type Start Date], [Type End Date])
 
T

Tandy

Ken, Rick and Mike,

Thank you all so much for you help! I knew I was close but I couldn't
get it just right for Access. Thank you again!

Tandy
 
Top