View Full Version : how to apply filter to a filter?


arage
08-10-2001, 07:38 AM
So I’m filtering my form on the openEvent & the first field available is a combo box. On the afterUpdate event of the combo box I’d like to apply another filter, so will the form then return a subset of the records that were returned upon the forms openEvent (dumb question but I have to ask)?

D-Fresh
08-10-2001, 08:13 AM
You can use the following in the AfterUpdate event of the combo box...

me.filter = me.filter & " AND " 'Enter your new filter criteria here....

Hope this helps..

Doug

arage
08-10-2001, 10:55 AM
I get a data type mismatch with the following:
Me.Filter = Me.Filter And "PromotionType =" & cboPromotionType
Me.Filter = Me.Filter And "[NewQuery]![PromotionType] =" & Me.cboPromotionType

And that the field NewQuery in expression cannot be found:
Me.Filter = Me.Filter And [NewQuery]![PromotionType] = Me.cboPromotionType

NewQuery is a part of the forms record source.

D-Fresh
08-10-2001, 10:59 AM
You just have the sytax incorrect... Use the ampersand(&) to concatenate the new filter...

Me.Filter = Me.Filter & " And PromotionType =" & cboPromotionType

Also, if PromotionType is a string value, then you have to put tick marks(') around the variable, like so...

Me.Filter = Me.Filter & " And PromotionType ='" & cboPromotionType & "'"

Hope this solution helps you...

Doug

arage
08-10-2001, 11:03 AM
Thank you very much D-Freshie http://www.access-programmers.co.uk/ubb/wink.gif that did the trick