calculating "how many" months

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

Guest

If I have 2 fields (DOB) and (service date) How woudl I calculate the
number of months between them? I need to use an access query to calculate
that. I appreciate all the great people on thsi website!
 
If I have 2 fields (DOB) and (service date) How woudl I calculate the
number of months between them? I need to use an access query to calculate
that. I appreciate all the great people on thsi website!

DiffInMonths:DateDiff("m",[DOB],[ServiceDate])
 
buckpeace said:
If I have 2 fields (DOB) and (service date) How woudl I calculate the
number of months between them? I need to use an access query to calculate
that.

Depends on what you mean by months. DateDiff("m", dob,
servicedate) will tell you how many month boundaries are
crossed (e.g. DateDiff("m", $1/31/07#, #2/1/07#) is 1 even
though it's only one day).

If you want the child's age in months at the service date,
then use a variation of
http://www.mvps.org/access/datetime/date0001.htm
 
Hi -

'correctly return number of whole months difference
'the (Day(dteEnd) < Day(dteStart)) is a Boolean statement
'that returns -1 if true, 0 if false
? DateDiff("m", dteStart, dteEnd) + (Day(dteEnd) < Day(dteStart))
 
Back
Top