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  

Age of a group for a fix day



 
 
Thread Tools Display Modes
  #1  
Old May 11th, 2008, 05:14 PM posted to microsoft.public.access.queries
Telesphore[_2_]
external usenet poster
 
Posts: 33
Default Age of a group for a fix day

How to calculate the age of the persons of a group for a precise day?

Example: what age do each one will have on July 1st 2008?

Thank you
  #2  
Old May 11th, 2008, 05:36 PM posted to microsoft.public.access.queries
fredg
external usenet poster
 
Posts: 4,386
Default Age of a group for a fix day

On Sun, 11 May 2008 12:14:19 -0400, Telesphore wrote:

How to calculate the age of the persons of a group for a precise day?

Example: what age do each one will have on July 1st 2008?

Thank you


Specifically July 1st 2008?
In a query:
Age: DateDiff("yyyy", [DOB], #7/1/2008#) - IIF(Format([DOB],
"mmdd") Format(#7/1/2008#, "mmdd"), 1, 0)

Directly as the control source of an unbound control:
=DateDiff("yyyy",[DOB],#7/1/2008#)-IIf(Format([DOB],
"mmdd")Format(#7/1/2008#,"mmdd"),1,0)

Where [DOB] is the birthdate field.
OK that's for July 1, 2008.
Now what do you do in 2009, 2010, etc.?

Change #7/1/2008# to
DateSerial(Year(Date()),07,01)
to have the value re-computed each January without user intervention.

You do know, I hope, that this Age computation should NOT be stored
in any table. Just compute it and display it on a form or report, as
needed.
--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail
 




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 01:43 PM.


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