Due date

  • Thread starter Thread starter mast
  • Start date Start date
M

mast

How can I automatically populate a text box with a date 6 months in the
future based on the date in another field. e.g. Field 1 - Battery test date &
field 2 - Next test due. Field 2 to be set 6 months from the date in field 1.
Field 1 is set from a pop up calendar and I would like to set field 2
automatically at the same time
 
hi,
How can I automatically populate a text box with a date 6 months in the
future based on the date in another field. e.g. Field 1 - Battery test date &
field 2 - Next test due. Field 2 to be set 6 months from the date in field 1.
Field 1 is set from a pop up calendar and I would like to set field 2
automatically at the same time
You need DateAdd() to calculate the new date. Depending on your needs
you can use either "=DateAdd("m", 1, Field1)" as ControlSource (then
this control is read-onyl. Otherwise if you need the date as a field
value use the On Change event of the first field.


mfG
--> stefan <--
 
That did it. Many thanks

Stefan Hoffmann said:
hi,

You need DateAdd() to calculate the new date. Depending on your needs
you can use either "=DateAdd("m", 1, Field1)" as ControlSource (then
this control is read-onyl. Otherwise if you need the date as a field
value use the On Change event of the first field.


mfG
--> stefan <--
 
Mast,

Some would ask why you need to bother storing the Due date if it is going to
be as set distance (6 months) from another date field in your database.
Now, if that is just the start point, and the date can be changed, then it
would make sense to store it, but you are just wasting space in the database
if it will always be 6 months from the PlacedInService date.

In that case, I would just add a control to your form and set the control
source to:

=DateAdd("m", 6, [PlacedInService])

or, if you want it to be blank if [PlacedInService] is blank, something
like:

=iiif(isnull([PlacedInService], "", DateAdd("m", 6, [PlacedInService]))

HTH
Dale
 
Thanks Dale

That is all I am doing really. Now that I can set the 'Due Date' based on
the 'Battery Test Date' I am using conditional formatting to turn the text
red once the 'Due Date' becomes overdue. The 'Battery Test Date' is the date
I need to store and the 'Due Date' is just my reminder that I need to do
something about it.

Many thanks

Dale Fye said:
Mast,

Some would ask why you need to bother storing the Due date if it is going to
be as set distance (6 months) from another date field in your database.
Now, if that is just the start point, and the date can be changed, then it
would make sense to store it, but you are just wasting space in the database
if it will always be 6 months from the PlacedInService date.

In that case, I would just add a control to your form and set the control
source to:

=DateAdd("m", 6, [PlacedInService])

or, if you want it to be blank if [PlacedInService] is blank, something
like:

=iiif(isnull([PlacedInService], "", DateAdd("m", 6, [PlacedInService]))

HTH
Dale

mast said:
How can I automatically populate a text box with a date 6 months in the
future based on the date in another field. e.g. Field 1 - Battery test
date &
field 2 - Next test due. Field 2 to be set 6 months from the date in field
1.
Field 1 is set from a pop up calendar and I would like to set field 2
automatically at the same time
 
Back
Top