To run a macro when the Filter event occurs, set the OnFilter property to the name of the macro.
You can set the Filter property in a Filter macro using the SetValue action. This enables you to customize the filter criteria that the user sees when the Filter By Form window or Advanced Filter/Sort window is displayed.
You can use the CancelEvent action in a Filter macro to cancel opening the filter window.
Filter Event — Event Procedures.