D
Darhl Thomason
I have a database built with Access 2003, it's in 2002/2003 format. I'm
trying to do what appears to me to be kind of a complex calculation that I
just can't quite figure out. Basically, I've built a database for my flying
club (we're all pilots). One of the rules to be a pilot is that you have to
have a flight physical every few years. But depending on how old you are on
your last flight physical dictates how long you can go before your next
flight physical. If you are less than 40 years old, then you can go three
years until your next physical. If you are 40 or older, then your next
physical can only be two years away.
I have a calculation that calculates your age based on your birthdate (field
name DOB). I also have the calculation that adds 2 years to your last
medical date (field name DateLastMedical). But that calculation really
needs to vary depending on the above. So the calculation should be
something like:
If age < 40 then NextMedicalDate = DateLastMedical + 3 years
else
NextMedicalDate = DateLastMedical + 2 years.
My current actual calculations are:
Age Calculation
=DateDiff("yyyy",[DOB],Now())+Int(Format(Now(),"mmdd")<Format([DOB],"mmdd"))
Medical Calculation
=DateSerial(Year([DateLastMedical])+2,Month([DateLastMedical]),Day([DateLastMedical]))
trying to do what appears to me to be kind of a complex calculation that I
just can't quite figure out. Basically, I've built a database for my flying
club (we're all pilots). One of the rules to be a pilot is that you have to
have a flight physical every few years. But depending on how old you are on
your last flight physical dictates how long you can go before your next
flight physical. If you are less than 40 years old, then you can go three
years until your next physical. If you are 40 or older, then your next
physical can only be two years away.
I have a calculation that calculates your age based on your birthdate (field
name DOB). I also have the calculation that adds 2 years to your last
medical date (field name DateLastMedical). But that calculation really
needs to vary depending on the above. So the calculation should be
something like:
If age < 40 then NextMedicalDate = DateLastMedical + 3 years
else
NextMedicalDate = DateLastMedical + 2 years.
My current actual calculations are:
Age Calculation
=DateDiff("yyyy",[DOB],Now())+Int(Format(Now(),"mmdd")<Format([DOB],"mmdd"))
Medical Calculation
=DateSerial(Year([DateLastMedical])+2,Month([DateLastMedical]),Day([DateLastMedical]))