Difference between 2 dates

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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
 
Use a control source expression similar to this in that other textbox:

=DateDiff("d", [Type Start Date], [Type End Date])
 
Tandy said:
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
Use the datediff function. It may have to be used with additional code
depending on your needs but can show the difference in days, months,
years...
 
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
 
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])
 
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])
 
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
 
Back
Top