Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Opposite of Show All Records?

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
Hi, I have a subform in a form that begins with filter on...then user clicks button and Show All Records will be on...then click another button and I want it to go back to the filtered view it was on originally. Easy way to do this?

thanks!
 
kgkdfhgkdh,

There are a few ways to do this, here's an easy one:

Click on your form properties and go to events.

Set your form open event to event procedure.

Open the code editor.

Go outside of your event procedure and put a public dim statement in the declaration section like so.

----
Option Compare Database
Option Explicit

Public strpubFilter As String
---

then go back inside the form1_Open() event and place the following code:

---
sub form1_Open()
pubstrFilter = Me.Filter
end sub
---

Finally,

On your (Reset Filter) Command Button, go to it's On Click event and put in the following code for the event procedure.

---
Sub Command0_Click()
me.filter = strpubFilter
end sub

There you go. That should do it. If you have any other questions or problems, let me know. I'll be watching the thread.


Bernie
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top