I have found it helpful to carry values forward to the next record on a form. This is how I do it. On the form's after update event you set the control's default value to the control's present value.
If you want to do this for multiple controls, you want to set the tag property of each control to CarryForward, then iterate through each control on the form.
I did not see an FAQ on this so I submitted it. Sorry if I am duplicating another post.
'For individual controls
Private Sub Form_AfterUpdate()
'Setup error handling
On Error GoTo Form_AfterUpdate_Err
'Carry the batch number forward
Me.Controls("controlname").DefaultValue = """" & Me.Controls("controlname").Value & """"
Form_AfterUpdate_Exit:
Exit Sub
Form_AfterUpdate_Err:
'Alert the user that an error has occurred
Call ErrorHandler(Err.Number, Err.Description, "frmACCT.Form_AfterUpdate")
Resume Form_AfterUpdate_Exit
End Sub
'For multiple controls
Private Sub Form_AfterUpdate()
'Setup error handling
Dim ctl as control
On Error GoTo Form_AfterUpdate_Err
'Carry the batch number forward for each control
For Each ctl in me.Controls
If ctl.Tag = "CarryForward"
ctl.DefaultValue = """" & ctl.Value & """"
End If
Next ctl
Form_AfterUpdate_Exit:
Set ctl = Nothing
Exit Sub
Form_AfterUpdate_Err:
'Alert the user that an error has occurred
Call ErrorHandler(Err.Number, Err.Description, "frmACCT.Form_AfterUpdate")
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.