remove filter using code

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

Guest

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
 
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 said:
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?
 
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?
 
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?
 
Back
Top