This is all a quick exercise in aircode, to point you in the right direction. I"m sure I'll type something wrong, but this should point you in a workable direction.
THe Form will have Properties
Code:
Filter => [DateFieldName] Between [txtHiddenFirst] AND [txtHiddenLast]
Filter On Load => Yes
That syntax is assuming the query is in the form rather than a subform.
Start by leaving the "hidden" text boxes visible and hardcoding the txtHiddenFirst and txtHidden values to a couple of years (2011, 2012) for test purposes. Prove that your query and filter syntax is working before going any farther.
After that, put code behind the click event of the "reset filter" or "clear filter" button that changes txthiddenFirst to 0000 and txtHiddenLast to 9999, and possibly blanks out the visible ones too. The VBA for setting a field is pretty easy. As long as you're in a control on the same form it should be
Code:
Private Sub CmdClearFilter_Click()
txtHiddenFirst = 0000
txtHiddenLast = 9999
End Sub
YOu'll want that same code in the On Load event of the form.
Sometimes you have to use this kind of syntax, depending on the default property of a control:
Code:
mycontrolname.Value = "whatever"
mycontrolname.SomeOtherProperty = "whatever"
Maybe you should set the test boxes so they only accept numeric values.
Code:
Private Sub CmdSetFilter_Click()
If txtFirst > "" {or numeric and greater than zero}
txtHiddenFirst = txtFirst
Else
txtHiddenFirst = 0000
End if
If txtLast > "" {or numeric and greater than zero}
txtHiddenLast = txtLast
Else
txtHiddenLast = 9999
End if
{you might put something here to swap them if the First is greater than the Last}
{it's not absolutely necessary, because BETWEEN doesn't care about order}
{if you do that, then be sure to swap both the hidden and visible ones }
Me.Requery
End Sub
This version would only set/adjust the filter when you click the setfilter button.