Last record & Default value

  • Thread starter Thread starter gr
  • Start date Start date
G

gr

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

Thx!
 
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top