VBA for Form.Filter

  • Thread starter Thread starter Christopher Glaeser
  • Start date Start date
C

Christopher Glaeser

I want a command button to filter a form by comparing two combo boxes for
equality. I found some code from an example that is similar (the example
compared a bound text box to a combo box). In my database, Combo8 is bound
to a table and cboChooseColor is unbound and used to set the filter value.

Form_frmDemoFilter.Form.Filter = "Combo8='" & Me.cboChooseColor & "'"
Form_frmDemoFilter.Form.FilterOn = True

Suggestions for the correct syntax for the comparison will be greatly
appreciated.

Best,
Christopher
 
A filter statement must use a field that is in the form's recordsource, not
a control on the form. Thus, replace Combo8 in your expression with the name
of the field to which it's bound.
 
A filter statement must use a field that is in the form's recordsource, not
a control on the form. Thus, replace Combo8 in your expression with the
name
of the field to which it's bound.

Bingo! Many thanks. - Christopher
 
Back
Top