Share via

Reset Filter

Anonymous
2016-06-30T13:46:32+00:00

Hi All,

Please assist correct my code below to reset the filter i.e to show all records after filtering a record on a subform

The unbound combo with a  name cboMobile1 and the reset command button is on the main form. It filters out the requested record but when the reset command button is pressed it does not show all records but only the one it filtered.

My reset command code is as follows:

Private Sub cmdReset_Click()

    Dim ctl As Control

    For Each ctl In Me.Section(acHeader).Controls

        Select Case ctl.ControlType

        Case acTextBox, acComboBox

            ctl.Value = Null

        Case acCheckBox

            ctl.Value = False

        End Select

    Next

    Me.FilterOn = False

End Sub

Microsoft 365 and Office | Access | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

2 answers

Sort by: Most helpful
  1. Anonymous
    2016-07-01T05:44:16+00:00

    Hi,

    Thank you for your response I tried but it gives me the following error:

    Compile error: Method or data not found

    Was this answer helpful?

    0 comments No comments
  2. DBG 11,711 Reputation points Volunteer Moderator
    2016-06-30T14:43:36+00:00

    Hi. Me.FilterOn = False applies to the form where the button is located. Since you said the button is on the main form but want to reset the filter on the subform, you are just resetting the filter on the main form. To reset the filter on the subform, you'll have to add the subform control's name. For example:

    Me.SubformControlName.Form.FilterOn = False

    Hope it helps...

    Was this answer helpful?

    0 comments No comments