PC Review


Reply
Thread Tools Rate Thread

Clear Filter on closing a form

 
 
=?Utf-8?B?RnJhbmsgU2l0dW1vcmFuZw==?=
Guest
Posts: n/a
 
      17th Jul 2007
Hello,

Waht is the VBA for every closing the form, the filter will atuotomatically
removed, because often that it will remember the filter and the clerck said "
I can not see my data that I just entered" they he/she did not remove the
filter.

On the form property I would write the VBA on close event.

Thanks in advance,

Frank

 
Reply With Quote
 
 
 
 
Douglas J. Steele
Guest
Posts: n/a
 
      17th Jul 2007
Try:

Private Sub Form_Close()

Me.FilterOn = False
Me.Filter = vbNullString

End Sub

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"Frank Situmorang" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hello,
>
> Waht is the VBA for every closing the form, the filter will
> atuotomatically
> removed, because often that it will remember the filter and the clerck
> said "
> I can not see my data that I just entered" they he/she did not remove the
> filter.
>
> On the form property I would write the VBA on close event.
>
> Thanks in advance,
>
> Frank
>



 
Reply With Quote
 
 
 
 
=?Utf-8?B?RnJhbmsgU2l0dW1vcmFuZw==?=
Guest
Posts: n/a
 
      18th Jul 2007
Doug,
I have put your code, but it does not work. I tried to open my form than I
put cursor in the amount field, and typed >1000000, then I filter by form, it
worked, it showed only amount bigger than 1 million, than I closed the form,
and I open it again, and I see the one that I typed in the amount field
>1000000 still showed.


I appreciate your idea again.

Thanks

Frank


"Douglas J. Steele" wrote:

> Try:
>
> Private Sub Form_Close()
>
> Me.FilterOn = False
> Me.Filter = vbNullString
>
> End Sub
>
> --
> Doug Steele, Microsoft Access MVP
> http://I.Am/DougSteele
> (no e-mails, please!)
>
>
> "Frank Situmorang" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > Hello,
> >
> > Waht is the VBA for every closing the form, the filter will
> > atuotomatically
> > removed, because often that it will remember the filter and the clerck
> > said "
> > I can not see my data that I just entered" they he/she did not remove the
> > filter.
> >
> > On the form property I would write the VBA on close event.
> >
> > Thanks in advance,
> >
> > Frank
> >

>
>
>

 
Reply With Quote
 
Douglas J. Steele
Guest
Posts: n/a
 
      18th Jul 2007
You sure the code is actually firing? Put a breakpoint in there to make sure
it is.

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)


"Frank Situmorang" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Doug,
> I have put your code, but it does not work. I tried to open my form than I
> put cursor in the amount field, and typed >1000000, then I filter by form,
> it
> worked, it showed only amount bigger than 1 million, than I closed the
> form,
> and I open it again, and I see the one that I typed in the amount field
>>1000000 still showed.

>
> I appreciate your idea again.
>
> Thanks
>
> Frank
>
>
> "Douglas J. Steele" wrote:
>
>> Try:
>>
>> Private Sub Form_Close()
>>
>> Me.FilterOn = False
>> Me.Filter = vbNullString
>>
>> End Sub
>>
>> --
>> Doug Steele, Microsoft Access MVP
>> http://I.Am/DougSteele
>> (no e-mails, please!)
>>
>>
>> "Frank Situmorang" <(E-Mail Removed)> wrote in message
>> news:(E-Mail Removed)...
>> > Hello,
>> >
>> > Waht is the VBA for every closing the form, the filter will
>> > atuotomatically
>> > removed, because often that it will remember the filter and the clerck
>> > said "
>> > I can not see my data that I just entered" they he/she did not remove
>> > the
>> > filter.
>> >
>> > On the form property I would write the VBA on close event.
>> >
>> > Thanks in advance,
>> >
>> > Frank
>> >

>>
>>
>>



 
Reply With Quote
 
New Member
Join Date: Aug 2012
Posts: 2
 
      4th Aug 2012
I have the same problem. I tried the code suggested and it didn't work either.
I have tried all sorts of code including:
Private Sub cmdRemoveFilters_Click()
If Me.Form.FilterOn Then
Me.Form.Filter = ""
Me.Form.FilterOn = False
End If
End Sub

I can't get the filter to clear. If I click on the button with the above code, which will permit me to filter by form again without anything in the field which I had put the previous selection criteria, but when I close the form, open it again, the same field in which I had the original search criteria still contains the search criteria. The only thing that works it to first click on the button with the above code, then filter by form.
But why won't it clear the filter on close (or open or load or whatever)?
 
Reply With Quote
 
New Member
Join Date: Aug 2012
Posts: 2
 
      4th Aug 2012
I just fournd this. It seems to work. I say that will a little intrepedation but I tried ti several times and it seemed to clear the filter. It is not my code, and I don't take responsibilty for it.
Private Sub Form_Open(Cancel As Integer)
On Error GoTo Form_Open_Err

Me.Filter = ""
Me.FilterOn = False

Form_Open_Exit:
Exit Sub

Form_Open_Err:
MsgBox Err.Number & " - " & Err.Description
Resume Form_Open_Exit

End Sub
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Using Macro to Open Filter by form, clear grid, then run filter Victoria@DIG Microsoft Access Macros 0 20th Apr 2008 12:46 AM
Showing form , closing login form but not closing app, how Bob Microsoft VB .NET 3 21st Dec 2005 08:54 PM
Closing event in a MID Child form I don't know if the child form is closing or the main form is closing **Developer** Microsoft C# .NET 1 19th Oct 2005 04:51 PM
Report Filter ? Clear Filter & Return to Full Report =?Utf-8?B?QnJvb2s=?= Microsoft Access Reports 0 28th Apr 2005 04:36 PM
clear history, not "Clear History" or "Clear Forms" or TypedURLS Nick Windows XP Internet Explorer 4 31st Mar 2004 05:22 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:12 AM.