Results 1 to 3 of 3
  1. #1
    3 Star Lounger
    Join Date
    Dec 2001
    Location
    Nevada, USA
    Posts
    207
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Repeat Report Detail Section (Access 2003)

    I have a requirement to print one or more repetitions of a detail line in a report, depending upon data conditions. I've set up a loop in VBA code which works properly. I just can't figure out how to repeat the detail print section (multiple variable times) for a given record from within VBA code.

    This post may be in the wrong forum. It may belong in the VB/VBA forum. Please move it if appropriate.

    TIA.
    Carol W.

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

    Re: Repeat Report Detail Section (Access 2003)

    This is the correct forum - we prefer to handle all Access questions, including Access VBA, here. <img src=/S/smile.gif border=0 alt=smile width=15 height=15>

    You can use code in the On Print event of the Detail section of the report:

    Private Sub Details_Print(Cancel As Integer, PrintCount As Integer)
    Static lngN As Long
    Static lngCount As Long
    ' calculate number of times detail section must be displayed / printed
    lngCount = ...
    If lngN < lngCount - 1 Then
    lngN = lngN + 1
    Me.NextRecord = False
    Else
    lngN = 0
    End If
    End Sub

  3. #3
    3 Star Lounger
    Join Date
    Dec 2001
    Location
    Nevada, USA
    Posts
    207
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Repeat Report Detail Section (Access 2003)

    Thanks so much, Hans.

    After a few false starts <img src=/S/stupidme.gif border=0 alt=stupidme width=30 height=30> , I've gotten your sample code to work.

    Thanks again.
    Carol W.

Posting Permissions

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