E_INVALIDARG when using NOT in CDO MessageFilter

  • Thread starter Thread starter Chris Fannin
  • Start date Start date
C

Chris Fannin

I'm having an issue using .Not on a CDO MessageFilter. Here's the code:

Set objFilter = objItems.Filter
objFilter.Not = True
Set objField = objFilter.Fields.Add("InquiryStatus", vbString, "Closed")
Set objField2 = objFilter.Fields.Add("BTImport", vbBoolean, "True")
Text1.Text = objItems.Count

It gives the error when trying to retrieve objItems.Count. However, if I
comment either one of the fields, it returns a value without error. It seems
to not want more than one filter value when using Not.

Anyone have any idea why this is failing when both fields are used?
 
Chris Fannin said:
It gives the error when trying to retrieve objItems.Count. However, if
I comment either one of the fields, it returns a value without error.
It seems to not want more than one filter value when using Not.

Anyone have any idea why this is failing when both fields are used?

It's possible that CDO simply isn't able to do a filter that complex.
There's no guarantee that any particular type of filtering is supported,
so perhaps CDO is just giving up when you ask it to do that much. In
general, when this sort of thing happens, you have to do part of the
filtering with CDO, and then sort through the rest of the results by hand
yourself.

-- dan
 
Back
Top