I have a snippet of code (below) that carries values in a form forward during data entry. These values appear in the form on the New record before the record is actually written and I would like them to be red instead of black so the user can easily see that they are on a new record as opposed to a written one.
The following works, sort of, but the red formatting remains for the written values of the carried over records after the record is written. So entering several records then going back to the entered records, the carried forward values are still red.
I would like those values to be black once they are actually written to the record, but red when floating as default values in the unwritten (New) record state.
Private Sub Form_AfterUpdate()
Dim ctl As Control
For Each ctl In Me.Controls
If ctl.Tag = "CarryForward" Then
ctl.DefaultValue = """" & ctl.Value & """"
ctl.ForeColor = vbRed
End If
Next ctl
End Sub
How might I modify this to only show the carried over default values in the new record as red but the written values as black?
The following works, sort of, but the red formatting remains for the written values of the carried over records after the record is written. So entering several records then going back to the entered records, the carried forward values are still red.
I would like those values to be black once they are actually written to the record, but red when floating as default values in the unwritten (New) record state.
Private Sub Form_AfterUpdate()
Dim ctl As Control
For Each ctl In Me.Controls
If ctl.Tag = "CarryForward" Then
ctl.DefaultValue = """" & ctl.Value & """"
ctl.ForeColor = vbRed
End If
Next ctl
End Sub
How might I modify this to only show the carried over default values in the new record as red but the written values as black?