Results 1 to 5 of 5
  1. #1
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Sydney, Australia, New South Wales, Australia
    Posts
    251
    Thanks
    0
    Thanked 4 Times in 4 Posts

    Report group by fortnight (2000)

    Just a quick question about grouping in a report. It's easy to group on a date field by week or month, but is there an easy way to groupby fortnight?
    Thanks
    Peter

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Report group by fortnight (2000)

    Enter a calculated expression in the Field/Expression box in the Sorting and Grouping window:

    =[DateField] 14

    where DateField is the name of the relevant date field.

  3. #3
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Sydney, Australia, New South Wales, Australia
    Posts
    251
    Thanks
    0
    Thanked 4 Times in 4 Posts

    Re: Report group by fortnight (2000)

    Thanks. Nice use of the integer division operator.

  4. #4
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Sydney, Australia, New South Wales, Australia
    Posts
    251
    Thanks
    0
    Thanked 4 Times in 4 Posts

    Re: Report group by fortnight (2000) - Side note

    Just as a side note, I got myself into trouble with this one, as I (incorrectly) guessed the order of precedence of the integer division operator.
    I'd guessed that it would be the same as normal division (and therefore multiplication). So in a more complex operation, I got stuffed.
    As an example, I thought:
    ? 2410*10
    would give me 20, but it actually gives Int(24 / (10*10)), equals 0.
    Caveat for new players.
    See http://safari.oreilly.com/9780789736673/ch04lev1sec3 and http://msdn.microsoft.com/archive/default....1/D6/S5B27E.asp
    Peter

  5. #5
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Report group by fortnight (2000) - Side note

    Good point. It's also mentioned in the VBA help - search for operator precedence.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •