AllowFilters Property
Applies To
Form.
Description
You can use the AllowFilters property to specify whether records in a form can be filtered.
Settings
The AllowFilters property uses the following settings.
Setting | Description | Visual Basic |
|
Yes | (Default) Records can be filtered. | True (–1) |
No | Records can't be filtered. | False (0) |
You can set this property by using the form's property sheet, a macro, or Visual Basic.
Remarks
Filters are commonly used to view a temporary subset of the records in a database. When you use a filter, you apply criteria to display only records that meet specific conditions. In an Employees form, for example, you can use a filter to display only records of employees with over 5 years of service. You can also use a filter to restrict access to records containing sensitive information, such as financial or medical data.
When the AllowFilters property is set to No, all of the filter options on the Records menu, the form's shortcut menu, and the Formatting (Form/Report) toolbar are disabled. The commands and buttons include:
- The Filter, Apply Filter/Sort, and Remove Filter/Sort commands.
- The Filter By Form, Apply Filter/Sort, and Remove Filter/Sort commands on the form's shortcut menu.
- The corresponding Filter By Selection, Filter By Form, and Apply Filter / Remove Filter buttons.
Note Setting the AllowFilters property to No does not affect the Filter and FilterOn properties. You can still use these properties to set and remove filters. You can also still use the following actions or methods to apply and remove filters:
Actions | Methods |
|
ApplyFilter | ApplyFilter |
OpenForm | OpenForm |
ShowAllRecords | ShowAllRecords |
See Also
ApplyFilter event, Filter event, Filter property, FilterOn property.
Example
The following example shows a function that toggles a form's AllowFilters property on and off:
Function ToggleAllowFilters() As Integer
Forms!Customers.AllowFilters = Not Forms!Customers.AllowFilters
End Function