Apply a Filter by Using a Macro — Example

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 GoToControls 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.

Click the action name to see the arguments for each action.

Condition Action Comment
    Attached to AfterUpdate event of CompanyNameFilter option group.
[Company Name Filters] =1 ApplyFilter Filter for company names that start with A, À, Á, Â, Ã, or Ä.
[Company Name Filters] =2 ApplyFilter Filter for company names that start with B.
[Company Name Filters] =3 ApplyFilter Filter for company names that start with C or Ç.

... Action rows for D through Y have the same format as those for A through C ...

[Company Name Filters] =26 ApplyFilter Filter for company names that start with Z, Æ, Ø, or Å.
[Company Name Filters] =27 ShowAllRecords Show all records.
[RecordsetClone].[RecordCount]>0 GoToControl If records are returned for the selected letter, move focus to the CompanyName control.