Trying to save a filtered form view for later use

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

Guest

I have a form that as a default I'd like to open with a subset of records.
After the form is open I might further sort, filter, or even want to view all
records. The problem is that when I close the form the filter property saves
the state of current filter and I don't want that. Each time I open the form
I want it to start out in a very specific filtered view while still retaining
the ability to show all records.

Lastly, I don't want the user to have to click threee or four times to get
to either of the two primary views (my prefered filter or all records).
Ideally, I'd like to command buttons. One labeled "my view" and one labeled
"all recorded".
 
To avoid saving any changes to a forms properties, rather than
DoCmd.Close
Use
DoCmd.Close acForm, Me.Name, acSaveNo

As to your filtering command buttons, in the Click event:

Me.Filter = 'Whatever your filtering opttions for this button are
Me.FilterOn = True

For the Show All Records:

Me.FilterOn = False
 
Back
Top