Last record & Default value

G

gr

Hello, how can I set the default value of a date field
equal to the last value + 2 weeks?

Thx!
 
A

Allen Browne

Use the AfterUpdate event procedure of the text box to create a string to
assign to its DefaultValue property:

Private Sub MyDate_AfterUpdate()
Me.MyDate.DefaultValue = """" & DateAdd("d", 14, Me.MyDate) & """"
End Sub

DateAdd() adds the 14 days.
The quote marks are needed to turn the result into the string.
The default value is seen when you move to the new record.
 
Top