HELP: Custom Filter Button

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

FORM TYPE: Continuous

The form I have created contains a list of records and there are 2
conditions that are the crux of the filter I am trying to create.

The field names are:
[RETEST] a date field
[RETESTED] true/false check box

The Conditions need to be:
[RETEST] < DATE() and [RETESTED]=FALSE

I am trying to code a command button that when pressed will show only the
records where the aforementioned conditions match.
 
You could try to make a select query with those two fields and set the
criteria to what you have, name it "mytest".
Then on the form with the command button, you could change the recordsouce
like
me.form.recordsource = "mytest"

If you want to go alittle further you could use in the commandbutton(use the
caption of "Apply Filter")

If Me.Commandbutton.Caption = "Apply Filter" Then
Me.Form.Recordsoucre = "mytest"
Me.Commandbutton.Caption = "Remove Filter"
Else
Me.Form.Recordsoucre = "your original recordsource"
Me.Commandbutton.Caption = "Apply Filter"
End If

Change the Commandbutton in the example above to whatever your button is
named.
Change the "Your original Recordsource" above to whatever you were using for
the original recordsource.

Hope this helps
David
 
Back
Top