This is very basic. It clears TextBoxes, Option buttons, and CheckBoxes on a Form.
VB Code:
Private Sub MyResetControls() ' On Error GoTo Err ' Dim Control As Object ' For Each Control In Me.Controls Control.Text = "" Control.Value = "" Next ' Exit Sub ' Err: If Err.Number = 438 Then Resume Next ElseIf Err.Number = 13 Then Control.Value = False Resume Next ElseIf Err.Number = 383 Then Control.Clear Resume Next Else Resume Next End If End Sub


Reply With Quote