Incremental increase of Date field in form

sal

Registered User.
Local time
Today, 13:31
Joined
Oct 25, 2009
Messages
52
I am trying to incrementally advance my initial date value in a data entry form to save a step in data entry. Here is the code I'm working with:

Private Sub Date_AfterUpdate()
Me!Date.DefaultValue = "#" & Format(Me!Date + 1, "yyyy-mm-dd") & "#"
End Sub

This carries forward the first value, but then continues carrying the same initial increment forward. Could someone kindly point out my error here. Thank you.
 
This did the trick:

Private Sub Form_AfterUpdate()
Dim ctl As Control
For Each ctl In Me.Controls
If ctl.Tag = "CarryForward" Then
ctl.DefaultValue = """" & ctl.Value & """"
End If
If ctl.Tag = "Advance" Then
ctl.DefaultValue = """" & ctl.Value + 1 & """"
End If
Next ctl
End Sub
 

Users who are viewing this thread

Back
Top Bottom