Overwriting Default Value

  • Thread starter Thread starter Andy Smith
  • Start date Start date
A

Andy Smith

I have managed to create a default value by adding a
number of months to a date and creating a new date. I did
this by entering the expression in the ControlSource
field of the Form.

I'd like to be able to overwrite this though with another
value when entering a new record. When I try it says the
contents are bound by the expression I created.

Any thoughts on how I can achieve this?

Thanks

Andy
 
The Default Value applies only to new records before they are created. It
does not supply a value of existing records that don't have any value
entered.

For new records, you can't assign a value based on a value in another field,
because that value doesn't exist yet. You could use the AfterUpdate event of
the other field to assign the value if you wish. The [Event Procedure] code
would look something like this:

Private Sub InvoiceDate_AfterUpdate
Me.[DueDate] = DateAdd("d", 14, Me.[InvoiceDate])
End Sub
 
Back
Top