Maria Tique Posted July 25, 2006 Posted July 25, 2006 (edited) Hi, Can you please help with a calculation that will subtract the visit date - date of birth. The results shall be provided to the user in years, months, weeks, and days. I have attached a small file for testing. thank you so much who ever you are.... Date_Calc.zip Edited July 25, 2006 by Guest
Lee Smith Posted July 25, 2006 Posted July 25, 2006 This question comes up from time to time. Do a search for [color:blue]+Birthday +Calculation as the [color:blue]Keywords, with or without my name as the username, and you will find many calculations that will provide the bases of what you are needing. Here is one of the most recent threads Link that should get you going. Just replace the [color:red]Get (CurrentDate) with your [color:red]visit field. HTH Lee
Maria Tique Posted July 25, 2006 Author Posted July 25, 2006 Hi, Thanks for the resource but i tried copying your code into my db into the fied age_years and no luck. I tried your code but substituted your currentdate field with my vis_date field and when i click ok i get a pop up message saying "This parameter is an ivalid get function". This is the code i used. GetAsNumber(Year(Get(vis_Date)) - Year(dateofbirth) - Case(Get(visDate) < Date(Month(dateofbirth); Day(dateofbirth); Year(Get(vis_Date))); 1; 0)) & " Years, " Would you know why it is not working?
Raybaudi Posted July 25, 2006 Posted July 25, 2006 Year( vis_date ) - Year( dateofbirth ) - ( vis_date < Date ( Month ( dateofbirth ) ; Day ( dateofbirth ); Year ( vis_date ) ) ) & " Years, " result text. BTW: this covers only the first part of your question how many years ?
Lee Smith Posted July 26, 2006 Posted July 26, 2006 (edited) Hi Maria, Compare this to what you were trying to put in the calculation GetAsNumber(Year(vis_Date)) - Year(Dob) - Case(vis_Date) < Date(Month(Dob); Day(Dob); Year(vis_Date))); 1; 0)) & " Years, " & GetAsNumber(Mod(Month(vis_Date)) - Month(Dob) + 12 - Case(Day(vis_Date)) < Day(Dob); 1; 0); 12)) & " Months, " & GetAsNumber(Day(vis_Date)) - Day(Dob) + Case(Day(vis_Date)) >= Day(Dob); 0; Day(vis_Date) - Day(vis_Date))) < Day(Dob); Day(Dob); Day(vis_Date) - Day(vis_Date))))) & " Days" HTH Lee Edited July 26, 2006 by Guest
mdpres Posted July 26, 2006 Posted July 26, 2006 (edited) Maria, I added a field with Lee's calc. Just change visit date and it will change the year month and day. Hope this helps you get an idea how it works. Dean Edited July 26, 2006 by Guest
Recommended Posts
This topic is 6757 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now