There is no if command between both 'end if' marked red.
You test for a blank value of strWhere, if it's blank you should not append the 'or' or 'and', if it's not you have to prefix with 'or' to prevent ending with an unwanted extra or at the end (code in green not tested).
For Each i In...