I think that the best approach here, and a good learning exercise, is to create a class extension that extends the string class.
Create a module in your project (the name of the module doesn’t matter, but I tend to favor ‘ClassExtensions’) and create a global method in that module:
Public Function InValues(extends aString as String, ParamArray values as String) as Boolean
return values.IndexOf(aString) <> -1
End Function
Now you can use it similar to your original code:
if rs.IdxField(9).StringValue.InValues("PICKUP","GRAPHICS","HOLD PARTS","HOLD VEHICLE") then
// Do something
end
Any reason you can’t apply that to the WHERE statement in the original SQL?
[quote=383620:@Tim Hare]Or use InStr
IF InStr("PICKUP,GRAPHICS,HOLD PARTS,HOLD VEHICLE", rs.IdxField(9).StringValue) > 0 then
[/quote]
one hole in that… “PICK” “ART”, “OLD” all return a >0 value