4

I have a field code with a strange behavior. When I put the code,

{ IF NUMPAGES=NUMPAGES "A" "B" }

I get A as expected however, when I reverse this, ie

{ IF NUMPAGES<>NUMPAGES "A" "B" }

I still get A.

Why is this happening?

1

You need to say

{ IF NUMPAGES <> NUMPAGES "A" "B" }

Word Help: Field codes: IF field says,

Operator

Comparison operator.  Insert a space before and after the operator.
                        ⋮

I can't find this documented anywhere, but it looks like Word is interpreting your code as

IF "NUMPAGES<>NUMPAGES" ≠ "" ... 
1
  • 1
    Just as a followup, it needs to have braces around NUMPAGES, ie { IF { NUMPAGES } <> { NUMPAGES } "A" "B" } – user1543042 Jun 22 '15 at 12:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.