Code on reset button not working (1 Viewer)

Angel69

Registered User.
Local time
Today, 17:19
Joined
Jun 11, 2013
Messages
86
I have some combo buttons in the form header that people can select to filter data in the subform by selecting an option the clicking a button that has code to filter the data. I have another button with the below code that clears all the filtered controls but it's not working all of a sudden. It's worked for 6 months and now it highlights the text 'ctl.Value = ctl.DefaultValue' in the code and opens the debugger. Any ideas?? TIA

Code:
Private Sub cmdReset_Click()
      'Purpose:   Clear all the search boxes in the Form Header, and show all records again.
Dim ctl As Control
    
    'Clear all the controls in the Form Header section.
    For Each ctl In Me.Section(acHeader).Controls
        Select Case ctl.ControlType
            Case acComboBox, acListBox, acOptionGroup, acTextBox
                ctl.Value = ctl.DefaultValue
        End Select
    Next
    
    'Remove the form's filter.
    Me.frmPacsFreeFormSubForm.Form.FilterOn = False
End Sub
 

JHB

Have been here a while
Local time
Today, 23:19
Joined
Jun 17, 2012
Messages
7,732
Why not set it to Null or ""?
 

Angel69

Registered User.
Local time
Today, 17:19
Joined
Jun 11, 2013
Messages
86
I did but I get Run-time error '2448: You can't assign a value to this object.
 

Users who are viewing this thread

Top Bottom