|
-
Feb 23rd, 2000, 02:06 AM
#1
Thread Starter
New Member
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
-
Feb 23rd, 2000, 04:24 AM
#2
Member
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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|