To apply the filter
Dim strFilter as String
strFilter = "[NameofField]=""" & me.ComboBoxName & """"
Me.Filter = strFilter
Me.FilterOn = True
To remove the filter
Me.FilterOn = False
Sometimes you have to force things and set the filter to a zero-length
string.
Me.Filter=""
'====================================================
John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
'====================================================
AA Arens wrote:
I have a similar demo using listboxes at:
http://www.accessmvp.com/Arvin/Combo.zip
Combos work exactly the same way. You cannot release a button and get the
results you want, but you can create another button with code like:
Private Sub cmdShowAll_Click()
DoCmd.RunCommand acCmdRemoveFilterSort
End Sub
to do it.
--
Arvin Meyer, MCP, MVPhttp://
www.datastrat.comhttp://www.mvps.org/accesshttp://www.accessmv...
I have a form with combo boxes. Contents: records of helpdesk tickets.
One of the combobox in cmbCompany.
I am looking for a commandbutton code that has the function to filter
on value of the combobox in the active record on the form.
Then the user can browse to other records that same the same combobox
value.
Releasing the button cancels the filtering.
Thank you.
Bart, Access 2003
Is it in any way possible to active the filter, referring to the value
from a combo?
I see it like this...
Private Sub cmdShowAll_Click()
Me!comboboxname etc...
DoCmd.RunCommand acCmdFilterSort
End Sub
Bart