By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,397 Members | 1,467 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,397 IT Pros & Developers. It's quick & easy.

Access incorrectly counts months between years

P: n/a
I'm trying to calculate the number of months between dates that begin
in 2003 and end in 2004(ex. 1/2/2003 - 7/2/2004). I need the total
months in 2003 and in 2004 both of which should add up to the length
of the date range. As in the example above the total month equals 18,
but Access gives me 11 for 2003 and 6 for 2004 which equals 17.. The
problem is Access doesn't appear to be counting the month from
12/13/2003 to 1/13/2004 in the 2003 total which causes my calculations
to be off by a month. I'm using the DateDiff key through query
design.
Nov 12 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
I just tried the following in the immediate window and it appears to work.

?datediff("m", #1/2/2003#, #7/2/2004#)
18

Can you show us the equation you're using?

--
Wayne Morgan
Microsoft Access MVP
"lpeterson" <lp*******@aipt.org> wrote in message
news:21**************************@posting.google.c om...
I'm trying to calculate the number of months between dates that begin
in 2003 and end in 2004(ex. 1/2/2003 - 7/2/2004). I need the total
months in 2003 and in 2004 both of which should add up to the length
of the date range. As in the example above the total month equals 18,
but Access gives me 11 for 2003 and 6 for 2004 which equals 17.. The
problem is Access doesn't appear to be counting the month from
12/13/2003 to 1/13/2004 in the 2003 total which causes my calculations
to be off by a month. I'm using the DateDiff key through query
design.

Nov 12 '05 #2

P: n/a
CDB
There is also the question of what is meant by "month".

datediff("m", #1/1/2003# to #1/31/2003#, #7/1/2004# to #7/31/2004#)
also give 18 for each pair in the range, even though there is almost two
month's difference in the time span.

Clive
"Wayne Morgan" <co***************************@hotmail.com> wrote in message
news:86******************@newssvr16.news.prodigy.c om...
I just tried the following in the immediate window and it appears to work.

?datediff("m", #1/2/2003#, #7/2/2004#)
18

Can you show us the equation you're using?

--
Wayne Morgan
Microsoft Access MVP
"lpeterson" <lp*******@aipt.org> wrote in message
news:21**************************@posting.google.c om...
I'm trying to calculate the number of months between dates that begin
in 2003 and end in 2004(ex. 1/2/2003 - 7/2/2004). I need the total
months in 2003 and in 2004 both of which should add up to the length
of the date range. As in the example above the total month equals 18,
but Access gives me 11 for 2003 and 6 for 2004 which equals 17.. The
problem is Access doesn't appear to be counting the month from
12/13/2003 to 1/13/2004 in the 2003 total which causes my calculations
to be off by a month. I'm using the DateDiff key through query
design.


Nov 12 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.