turn off/on applyfilter via checkbox

B

Bruce

I have the following function that I apply to a form for an applyfilter.

Function filterHistory()

DoCmd.ApplyFilter "filterHistory", "[tbl_Dividend]![Ex_Div_Date]>Date()"

End Function

How can I turn the filter off/on via a checkbox.

Bruce
 
B

Bricker

if true then
form.filteron=false
'in case filter does not work there will be no filter set
'you might want to use the form name to make sure it applies to that form.
'example Forms!formname.filter="filter"
'docmds work with what object is active or its form.
form.filter="filter" Or your function() 'SQL statement
form.filteron=true
else
form.filteron=false
endif
I guess you can use docmd.applyfilter but I think it applies without ability
to turn on.
 
Top