Default Date for Date Control

  • Thread starter Thread starter Steve W
  • Start date Start date
S

Steve W

I have a control (for a date) where I would like the default value to be
calculated with reference to another control ie. the 20th of the month
following

eg
first date 4 April 2004
calculated default date would equal - 20 May 2004


what would the code/syntax be....................


Steve Wilson
 
Steve

The "default" date of a field or control is the value it holds before any
other values are set. I don't believe there's a way to use "default" and
get what you're after.

On the other hand, if you were to add an event procedure in your "first
date" control's AfterUpdate event, it could set the value of the other
(dependant) control using the DateSerial() function.

I feel compelled to point out, though, that it would not be a good idea to
have that dependant control actually bound to/updating a table field.
There's rarely a need in Access to store calculated values such as you
describe. If a value can be derived/calculated from other values, simply
use a query to do so as needed for forms, reports, etc. If you want a
reason why not to store calculated values, think synch. As in, how will you
keep the components synchronized if/when one value changes?
 
Back
Top