A really easy way
In the form header or footer of a continuous form have 2 buttons. (you can use it with a single form, but it's easier to see with a continuous form).
Call one
"apply filter" - there's a built in graphic for this if you prefer.
Call the other
"remove filter" - again, there's a graphic available.
you might want error handling in case the command isn't available.
Click in whatever your interested in, first THEN click the "apply filter" button.
use this code
screen.previouscontrol.setfocus 'this jumps back to the field you wanted
runcommand acCmdFilterBySelection
"remove filter" button.
Simply
The filter is successive. You can keep zooming in by successive selections. It doesn't let you use the flexibility of the filter options demonstrated by
@MajP , but on the other hand, it's dead easy to programme as a basic function. It also saves you time programming what the users might want, and just lets them use whatever they want by themselves.
if your form has some totals, you will see these changing to reflect your applied filters