1. Open the form for editing and turn off design mode.
2. Do the work once using the form based filter. In the filter navigator, the resulting filter may look like this one showing all records where some CID is Null or eiher one of 4, 10, 1, 9 or 7: 3. Turn off desgn mode. The form's data properties will show the current filter string like this: Copy that filter string.
4.1. Add a push button to the filtered (sub-)form with property "Toggle" = Yes.
4.2. Paste the filter string into the button's "Additional information" property.
4.3. Assign the following macro to the button's execute event:
Code: Select all
Sub Button_Filter_OnOff(e)
b = cBool(e.Selected)
m = e.Source.Model
s = m.Tag
frm = m.Parent
REM print frm.Filter
frm.ApplyFilter = b
frm.Filter = s
frm.reload()
End Sub
5.1. If yes, set the button's "Default state" to "Selected" and save the form with the set filter string.
5.2. If you want to load the form unfiltered by default, delete the filter string from the form properties and keep the button's "Default state" as "not selected".