To run the ShowAllRecords action in Visual Basic, use the ShowAllRecords method of the DoCmd object.
Example
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.
Condition | Action | Arguments: Setting | Comment |
---|---|---|---|
[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. |