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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Form stores the last used Filter. How to clear it?

Status
Not open for further replies.

surotkin

Programmer
Dec 10, 2003
103
CA
Hi everyone,
I allow users to filter data in a form.
When I open the form in Design View mode the FILTER property stores the last used filter string.

I used the following code on FORM_CLOSE event
Code:
Private Sub Form_Close()

    Me.Filter = ""
    Me.FilterOn = False
    DoCmd.Save acForm, Me.Name

End Sub

However, when I open the form in Design View mode the FILTER property still stores the last used filter string.

Does anybody know how to force MS Access not to store the last used filter string or how to clear FILTER property when closing the form?

I know that I can use FORM OPEN event to clear it:
Code:
Private Sub Form_Open(Cancel As Integer)

    Me.Filter = ""
    Me.FilterOn = False

End Sub

however, my question is how to prevent storing it, so FILTER property is BLANK when I open the form in Design View?

Thanks.
surotkin
 
I suggest you use the form load event, rather than form close, that way, the filter is cleared when the form is opened.
 
Hi Remou,
thanks for your reply, however I didn't get your suggestion.
I use Open Form Event, you suggest to use Load instead.
Isn't Load Event occurs after Open Event?

My original question was:
MS Access saves FILTER property from the last use of the form. How to disable it?

Thanks.
surotkin
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top