ServerFilterByForm Property

Microsoft Access Visual Basic

expression.ServerFilterByForm

expression    Required. An expression that returns one of the objects in the Applies To list.

Remarks

The ServerFilterByForm property uses the following settings.

Setting Visual Basic Description
Yes True The form is opened in the Server Filter By Form window.

Note  When the ServerFilterByForm property is True, the Filter By Form feature is disabled.

No False (Default) The form is not opened in the Server Filter By Form window.

Note  The easiest way to set the ServerFilterByForm property is by using a form's property sheet. You can set this property by using Visual Basic.

To set the ServerFilterByForm property, you must first either:

  • Set the property in the form's property sheet.

  • Set the property in Visual Basic by typing
    Forms(0).ServerFilterByForm = True
    				

If the ServerFilter property has been set, you can also set this property by clicking Apply Server Filter on the Form View toolbar or the Filter/Sort toolbar.

To apply a saved filter to a form, press the Apply Server Filter button, or apply the filter by using a macro or Visual Basic by setting the ServerFilterByForm property to True.

The Apply Server Filter button indicates the state of the ServerFilter and ServerFilterByForm properties. The button remains disabled until there is a filter to apply. If an existing filter is currently applied, the Apply Server Filter button appears pressed in. To apply a filter automatically when a form opened, specify in the OnOpen event property setting of the form either a macro that uses the ApplyFilter action or an event procedure that uses the ApplyFilter method of the DoCmd object.

You can remove a filter by using Visual Basic to set the ServerFilterByForm property to False or clear all filter criteria in the Server Filter By Form window and then click Apply Server Filter.

Notes

Example

The following example enables the "Order Lookup" form to be opened in a Microsoft Access Data Project in the Server Filter By Form window.

Forms("Order Lookup").ServerFilterByForm = True