N
Nick C
I have a command button in a data entry form that, when clicked, clears all
values except the date. Here is the code below:
Private Sub cmdClear_Click()
Dim c As Control
For Each c In Me.Controls
If (c.ControlType = acTextBox Or c.ControlType = acComboBox) Then
'Check to see if it is the date field
If (Not (c.Name = "txtDate")) Then
'clear contents
c.Value = Null
End If
End If
Next c
End Sub
I would like to duplicate this functionality in another form. However, the
other form has an AutoNumber Field and the Value property is not available.
When I try to use OldValue, I get an error stating (Object Required). I
have tried to set an object but have been unsuccessful in getting the code
to work thus far.
Any help at this point would be GREATLY appreciated. This has kept me up
the majority of the night.
Thanks very much in advance,
Nick
values except the date. Here is the code below:
Private Sub cmdClear_Click()
Dim c As Control
For Each c In Me.Controls
If (c.ControlType = acTextBox Or c.ControlType = acComboBox) Then
'Check to see if it is the date field
If (Not (c.Name = "txtDate")) Then
'clear contents
c.Value = Null
End If
End If
Next c
End Sub
I would like to duplicate this functionality in another form. However, the
other form has an AutoNumber Field and the Value property is not available.
When I try to use OldValue, I get an error stating (Object Required). I
have tried to set an object but have been unsuccessful in getting the code
to work thus far.
Any help at this point would be GREATLY appreciated. This has kept me up
the majority of the night.
Thanks very much in advance,
Nick