-
This is a general programming question. I'm actually using it in Crystal Reports, but it's just the logic that I need.
I want to say if the pagenumber is odd-numbered then do X, if it's even-numbered then do Y. I just can't find a good mathematical way of figuring that out.
For example, if [pagenumber] is divisible by 2, then it's even. And if [pagenumber] is NOT divisible by 2, then it's odd. But that doesn't really work. Anyway, there must be a simple way of doing this. Maybe using the '%' operator??
Thank you for your help!!
Andrea :)
-
Try using the modulas operator (MOD). MOD command find the remainder of one number divided by another
For Example,
OddEven = PageNumber MOD 2
Or use it in an If...Then,
If (PageNumber MOD 2) = 0 Then 'zero remainder
'even page
Else
'odd page
Endif