Filter on Load

if there are only 2 choices you simply need

me.filteron = not me.yourcheckboxname
How simple can it be? At least so simple that I couldn't think of it 🤢
 
Personally I would just have a procedure

Code:
Private sub MyFilter()
Dim strFilter as string

strfilter = "SomeField = " & SomeValue
me.filterOn = not Me.MyCheckBox             ' or  me.filterOn =  Me.MyCheckBox   depending on how you want to filter

end sub

Then just call it in form load and the after update of the checkbox.

The bigger problem will be the fiscal year dates year after year which OP will have to eventually address.
 
if there are only 2 choices you simply need

Code:
me.filter = "[Completion Time] Between #10/1/2022# And #9/30/2023#"

me.filteron = not me.ckbxSeeAll
That worked!

Thanks so much!
 
Your welcome. What are you going to do next fiscal year?
 
What are you going to do when you hit the next fiscal year? If you are hard coding the filter you'll have to change it each year.

It would seem to me that all you want to do is toggle the filter on or off.

In the attached I have a field in the forms record source which is the fiscal year for the date field.
A combo box has a row source of all the distinct FY's.
The check box toggles the filter on or off.
I used this example and it worked great. Now that I am in FY24 how do I make the default (filter) year 2024?
 
I used this example and it worked great. Now that I am in FY24 how do I make the default (filter) year 2024?
Test the current date and construct the filter accordingly?
 
I used this example and it worked great. Now that I am in FY24 how do I make the default (filter) year 2024?
Maybe change the load event as shown.
instead of using year(date) as the value for the combo, use the current fiscal year.

Code:
Private Sub Form_Load()
    Me.cboFY = GetFiscalYear(Date, 10)
    Me.Check21 = -1
    FilterMe
    
End Sub
 

Users who are viewing this thread

Back
Top Bottom