1) Where the error comes from, I can't see that's from the code you gave

2) You seem to have problems with operator precedence; use parentheses to get it right (and is like multiplication, or is addition).

A and B or A and C

is equivalent to

A and (B or C)

3) The fields sum1 and sum2, are they numeric? Then remove the double-quotes, as in

If doc.trev(0)="Y" And (doc.sum1(0)<1000 Or doc.sum2(0)<1000) Then

4) Your logic probably isn't quite right. You want to do one thing if a>1000 or b>1000,

you want to do another thing if a<1000 or b<1000 but did you realise that you

will always use the first alternative when a=500 and b=1500?

The Else-part will therefore ONLY be used when a=1000 AND b=1000!