Results 1 to 2 of 2

Thread: Determining Even and Odd numbered Pages

  1. #1

    Thread Starter
    New Member
    Join Date
    Aug 1999
    Posts
    6

    Post

    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

  2. #2
    Member
    Join Date
    Feb 2000
    Location
    Toronto, Canada
    Posts
    44

    Post

    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
  •  



Click Here to Expand Forum to Full Width