paul822 wrote:I would like to use a calculation field in a database using a date from a field and adding 21 years in one field and 22 years in an additional field. I know it's possible. I searched through all my old journals and the forum and couldn't find anything. Thanks in advance.
Barry wrote:paul822 wrote:I would like to use a calculation field in a database using a date from a field and adding 21 years in one field and 22 years in an additional field. I know it's possible. I searched through all my old journals and the forum and couldn't find anything. Thanks in advance.
Try this:
TEXTTODATE(DAY('date')&"/"&MONTH('date')&"/"&(YEAR('date')+21))
The Day, Month and Year portions must be set in the same order as the numeric date format used by AppleWorks on your machine. Mine uses dd/mm/yyyy
Change "21" to "22" for the second field.
Double click the fields in Layout to set the Date format to your preferred form.
The formula will give an error if the starting date is February 29. Some thooughts on that later.
Regards,
Barry
paul822 wrote:Barry wrote:paul822 wrote:I would like to use a calculation field in a database using a date from a field and adding 21 years in one field and 22 years in an additional field. I know it's possible. I searched through all my old journals and the forum and couldn't find anything. Thanks in advance.
TEXTTODATE(DAY('date')&"/"&MONTH('date')&"/"&(YEAR('date')+21))
The formula will give an error if the starting date is February 29. Some thoughts on that later.
Thanks so much. With some tweaking of my date formats it worked like a charm and saved hours of manual entry of dates.
Paul