A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

remove filter using code



 
 
Thread Tools Display Modes
  #1  
Old July 14th, 2004, 03:30 AM
Sam Kuo
external usenet poster
 
Posts: n/a
Default remove filter using code

Hi,
I would like to remove filter in a form so I can then carry out the next action with a combo box. Is there an alternative other than clicking the "Remove Filter" icon on toolbar? Perhaps a code in the combo box property that does it?

Any help is much apreciated!
Sam

  #2  
Old July 14th, 2004, 03:45 AM
Al Borges
external usenet poster
 
Posts: n/a
Default remove filter using code

Hi Sam:

Just reset the form's recordsource through code:

Table1.RecordSource = "SELECT Table1.* FROM Table1 ORDER BY
[Table1].[ddate];"

If you are using a ComboBox, you might want to do something like this in its
AfterUpdate event:

Select Case ComboBox2.Value
Case "Filter On"
Table1.RecordSource = "SELECT Table1.* FROM Table1 ORDER BY [Table1].[ddate]
Where Table1.Acct = 23456;"
Case "Filter Off"
Table1.RecordSource = "SELECT Table1.* FROM Table1 ORDER BY
[Table1].[ddate];"
End Select

Regards,
Al

"Sam Kuo" .(donotspam) wrote in message
...
Hi,
I would like to remove filter in a form so I can then carry out the next

action with a combo box. Is there an alternative other than clicking the
"Remove Filter" icon on toolbar? Perhaps a code in the combo box property
that does it?

Any help is much apreciated!
Sam



  #3  
Old July 14th, 2004, 07:29 AM
external usenet poster
 
Posts: n/a
Default remove filter using code

DoCmd.RunCommand acCmdRemoveFilterSort

is exactly the same as clicking the "Remove Filter" icon.

You can also set"


-----Original Message-----
Hi,
I would like to remove filter in a form so I can then

carry out the next action with a combo box. Is there an
alternative other than clicking the "Remove Filter" icon
on toolbar? Perhaps a code in the combo box property that
does it?

Any help is much apreciated!
Sam

.

  #4  
Old July 14th, 2004, 07:32 AM
Van T. Dinh
external usenet poster
 
Posts: n/a
Default remove filter using code

DoCmd.RunCommand acCmdRemoveFilterSort

is the same as clicking the "Remove Filter" Icon.

You can also use:

Me.Filter = ""

or

Me.FilterOn = False

They have different meanings but the end result is the
same. See Access VB Help on Filter and FilterOn Property.

HTH
Van T. Dinh
MVP (Access)



-----Original Message-----
Hi,
I would like to remove filter in a form so I can then

carry out the next action with a combo box. Is there an
alternative other than clicking the "Remove Filter" icon
on toolbar? Perhaps a code in the combo box property that
does it?

Any help is much apreciated!
Sam

.

  #5  
Old July 15th, 2004, 12:06 AM
Sam Kuo
external usenet poster
 
Posts: n/a
Default remove filter using code

Thanks alot! Al, anonymous and Van
Your suggestions have been very helpful

Regards,
Sam
 




Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Filter macro / code builder help? StargateFan General Discussion 5 June 24th, 2004 05:39 PM
Expression - calculating running total Kathy Running & Setting Up Queries 26 June 22nd, 2004 10:14 PM
Applying Filter in code Rob-LMS Setting Up & Running Reports 4 May 26th, 2004 06:56 PM


All times are GMT +1. The time now is 05:02 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.