A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

calculating "how many" months



 
 
Thread Tools Display Modes
  #1  
Old February 19th, 2007, 08:09 PM posted to microsoft.public.access.queries
buckpeace
external usenet poster
 
Posts: 18
Default calculating "how many" months

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!
--
Buck
  #2  
Old February 19th, 2007, 08:51 PM posted to microsoft.public.access.queries
fredg
external usenet poster
 
Posts: 4,386
Default calculating "how many" months

On Mon, 19 Feb 2007 12:09:05 -0800, buckpeace wrote:

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!


DiffInMonthsateDiff("m",[DOB],[ServiceDate])
--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail
  #3  
Old February 19th, 2007, 08:54 PM posted to microsoft.public.access.queries
Marshall Barton
external usenet poster
 
Posts: 5,361
Default calculating "how many" months

buckpeace wrote:

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

--
Marsh
MVP [MS Access]
  #4  
Old February 19th, 2007, 10:50 PM posted to microsoft.public.access.queries
raskew via AccessMonster.com
external usenet poster
 
Posts: 370
Default calculating "how many" months

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))


Marshall Barton wrote:
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


--
Message posted via http://www.accessmonster.com

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 03:42 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.