ShowAllRecords Macro Action
You can use the ShowAllRecords action to remove any applied filter from the active table, query result set, or form, and display all records in the table or result set or all records in the form's underlying table or query.
The ShowAllRecords action doesn't have any arguments.
You can use this action to ensure that all records (including any changed or new records) are displayed for a table, query result set, or form. This action causes a requery of the records for a form or subform.
You can also use this action to remove any filter that was applied with the ApplyFilter action, the Filter command on the Home tab, or the Filter Name or Where Condition argument of the OpenForm action.
This action has the same effect as clicking Toggle Filter on the Home tab, or right-clicking the filtered field and clicking Clear filter from... in Form view, Layout view, or Datasheet view.
To run the ShowAllRecords action in a Visual Basic for Applications (VBA) module, use the ShowAllRecords method of the DoCmd object.
Apply a filter by using a macro
The following macro contains a set of actions, each of which filters the records for a Customer Phone List form. It shows the use of the ApplyFilter, ShowAllRecords, and GoToControl actions. It also shows the use of conditions to determine which toggle button in an option group has been selected on the form. Each action row is associated with a toggle button that selects the set of records starting with A, B, C, and so on, or all records. This macro should be attached to the AfterUpdate event of the CompanyNameFilter option group.
|[Company Name Filters] =1||ApplyFilter||Where Condition: [Company Name] Like "[AÀÁÂÃÄ]*"||Filter for company names that start with A, À, Á, Â, Ã, or Ä.|
|[Company Name Filters] =2||ApplyFilter||Where Condition: [Company Name] Like "B*"||Filter for company names that start with B.|
|[Company Name Filters] =3||ApplyFilter||Where Condition: [Company Name] Like "[CÇ]*"||Filter for company names that start with C or Ç.|
... Action rows for D through Y have the same format as A through C ...
|[Company Name Filters] =26||ApplyFilter||Where Condition: [Company Name] Like "[ZÆØÅ]*"||Filter for company names that start with Z, Æ, Ø, or Å.|
|[Company Name Filters] =27||ShowAllRecords||Show all records.|
|[RecordsetClone].[RecordCount]>0||GoToControl||Control Name: CompanyName||If records are returned for the selected letter, move focus to the CompanyName control.|