OBJECT SET FILTER sets the entry filter for the objects specified by object to the filter you pass in entryFilter.
If you specify the optional * parameter, you indicate an object name (a string) in object. If you omit the optional * parameter, you indicate a field or a variable in object. In this case, you specify a field or variable reference (field or variable objects only) instead of a string. For more information about object names, see the Object Properties section.
OBJECT SET FILTER can be used for input and dialog forms and can be applied to fields and enterable variables that accept an entry filter in the Design environment.
Passing an empty string in entryFilter removes the current entry filter for the objects.
Note: This command cannot be used with fields located in a subform’s list form.
Note: In entryFilter, to use entry filters you may have predefined using the Tool Box, prefix the name of the filter with a vertical bar (|).
The following example sets the entry filter for a postal code field. If the address is in the U.S., the filter is set to ZIP codes. Otherwise, it is set to allow any entry:
If([Companies]Country="US")
OBJECT SET FILTER([Companies]ZIP Code;"&9#####")
Else
OBJECT SET FILTER([Companies]ZIP Code;"~@")
End if
The following example allows only the letters “a,” “b,” “c,” or “g” to be entered in two places in the field Field:
Note: This example sets the entry filter to &"a;b;c;g"##.