Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / New Users / October 2007

Tip: Looking for answers? Try searching our database.

Age of Patient

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Heather - 18 Oct 2007 17:12 GMT
I need help.  I'm new at this and I'm trying to write a facesheet and
armband that will calculate the age and also put it in Years, Months,
and Days.  Here is what I have so far but the problem is that it
putting it in years.  I at a loss on what to do to get the month and
day.

select
ACCT_REC.ACCT_NUM as acctBC,
ACCT_REC.ACCT_NUM,
REG_REC.PATIENT_DISPLAY_NAME,
REG_REC.RACE,
YEAR(TODAY()) - YEAR(REG_REC.DOB) - CASE WHEN month(TODAY()) >
month(REG_REC.DOB) THEN 0 WHEN month(TODAY()) < month(REG_REC.DOB)
THEN 1 WHEN day(TODAY()) < day(REG_REC.DOB) THEN 1 ELSE 0 END as
"Age",
REG_REC.DOB,
PRSNEUP.ID as phybc,
PRSNEUP.ID as MRN,
ASSOCTP.DISPLAY_NM

From
((ACCT_REC INNER JOIN
REG_REC ON ACCT_REC.ACCT_PTPTR = REG_REC.PTPTR )
LEFT OUTER JOIN
ASSOCTP ON ACCT_REC.ACCT_PRIMARY_PROV = ASSOCTP.NUM )
INNER JOIN
PRSNEUP ON REG_REC."#" = PRSNEUP.PERSON_NUM
where
PRSNEUP.ID > 10000
and
ACCT_REC.ACCT_NUM = $()
fredg - 18 Oct 2007 17:41 GMT
> I need help.  I'm new at this and I'm trying to write a facesheet and
> armband that will calculate the age and also put it in Years, Months,
[quoted text clipped - 27 lines]
> and
> ACCT_REC.ACCT_NUM = $()

If you are looking to compute years, months and days, take a look at:

"A More Complete DateDiff Function" at
http://www.accessmvp.com/djsteele/Diff2Dates.html

which will do all 3 using just the one function, i.e. 25 years 4
months 15 days,
Signature

Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.