Hello, I have copied this code from a FAQ and it looks like it will do exactly what I need. There is one small problem, it does nothing not even throw and error. What am I missing????? I have two text boxes on a form that are from a table that I want to set to the previous records values. So how do I fix this code or just get my result which is to set the default value of a text box to the previous records value.?
Private Sub Consumed_Carton_ID_AfterUpdate()
Dim ctl As Control
On Error GoTo Consumed_Carton_ID_AfterUpdate_Err
'Set the new records default values to the previous records values
For Each ctl In Me.Controls
'any records needing a previous value set the tag name to "Carryforward"
If ctl.Tag = "CarryForward" Then
ctl.DefaultValue = """" & ctl.Value & """"
End If
Next ctl
Consumed_Carton_ID_AfterUpdate_Exit:
Set ctl = Nothing
Exit Sub
Consumed_Carton_ID_AfterUpdate_Err:
'Alert the user that an error has occurred
Call ErrorHandler(Err.Number, Err.Description, "Consumed_Carton_ID_AfterUpdate")
Resume Consumed_Carton_ID_AfterUpdate_Exit
End Sub
Private Sub Consumed_Carton_ID_AfterUpdate()
Dim ctl As Control
On Error GoTo Consumed_Carton_ID_AfterUpdate_Err
'Set the new records default values to the previous records values
For Each ctl In Me.Controls
'any records needing a previous value set the tag name to "Carryforward"
If ctl.Tag = "CarryForward" Then
ctl.DefaultValue = """" & ctl.Value & """"
End If
Next ctl
Consumed_Carton_ID_AfterUpdate_Exit:
Set ctl = Nothing
Exit Sub
Consumed_Carton_ID_AfterUpdate_Err:
'Alert the user that an error has occurred
Call ErrorHandler(Err.Number, Err.Description, "Consumed_Carton_ID_AfterUpdate")
Resume Consumed_Carton_ID_AfterUpdate_Exit
End Sub