We help IT Professionals succeed at work.

Date field2 calculate 30 days after the date of date field1

Blacksh asked
Hello. I am using Microsoft Access 2000. I have two date fields in a form. Datefield1 is any date (usually today's date). I would like date field2 to calculate 30 days from date field1. I am using a form that is connected to a table.
Watch Question

Top Expert 2016

  you can use DateAdd()fucntion

place this code in the current event of the form or in the afterupdate event of field1

Top Expert 2009
It is better to place the DateAdd expression in the control source of an unbound textbox.  The expression will not be written to the table field, but it should not be, since it could become inaccurate if the first date was changed.  You can also use the DateAdd expression in a query, used as the form's record source.  That way it will always be accurate.
Most Valuable Expert 2015
Distinguished Expert 2018

Use the ControlSource of the TextBox for field2 to obtain an automatic update whenever field1 changes. If "from field1" means "before field1" then:


However, at months' end - ultimo - you will probably obtain a better result by subtracting a month:


Further, field1 may be empty (Null), thus:


Of course, if "from field1" means "after field1" then remove the minus sign.


Thank you very much.