first_page the funky knowledge base
personal notes from way, _way_ back and maybe today

Filter by Form Events; VBA Filter Property; Order of Events; Constants

Filter by Form (applying the filter): Filter Event; FilterType = acFilterByForm = 0 Apply Filter Event; ApplyType = acApplyFilter = 1 Current Event

During this Apply Filter event, Access changes the FilterOn property to True. This implies that the Filter property has been changed to a valid SQL WHERE clause.

Removing a form filter: Apply Filter Event; ApplyType = acShowAllRecords = 0 Current Event

During this Apply Filter event, Access changes the FilterOn property to False and leaves the Filter property unchanged.

Filter by Form (closing the filter form): Filter Event; FilterType = 0 Apply Filter Event; ApplyType = acCloseFilterWindow = 2 Current Event

Using VBA to change the Filter property does not cause any filter related events to fire (the Current event does not fire either) if and only if the FilterOn property equals False.

However changing the Filter property to a valid SQL WHERE clause when FilterOn = True causes the following: Current Event Apply Filter Event; ApplyType = 1 Current Event

Using VBA to change the FilterOn property to False causes the Current event to fire if and only if the Filter property is not equal to Empty.

Using VBA to change the FilterOn property to True (when the Filter is not equal to Empty) causes the following events: Apply Filter Event; ApplyType = 1 Current Event

Setting Cancel = True inside the ApplyFilter event with VBA prevents the Filter by Form window from "closing." This is not very useful. Setting the FilterOn property to False (and setting the TimerInterval property > 0) during the ApplyFilter event may prove to be very useful. One caveat: we have seen that changing the FilterOn property against a valid filter causes the Current event to fire.

mod date: 1998-07-29T20:48:50.000Z