Calculations using dates

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

Guest

On a report, how can I subtract DateA from DateB, ignoring those were DateB
is null? Also, I'm looking for the number of months, not the number of days
between the 2 dates. Thank you.
 
Try this in the Control Source of a textbox.

=DateDiff("m", [DateBField], [DateAField])

It will return Null if either field is Null. If you want a positive number
and get a negative number, just reverse which date is which in the equation.
While this will return months, it will return them based on the number value
of the month, it will ignore the date in the month. For example, if today is
1 June 2006 and you subtract 31 January 2006, you will get -5 for June -
January even though it hasn't been 5 full months. This can be compensated
for, depending on what you're looking for.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top