[AccessD] Blank Lines in report

A.D.Tejpal adtp at airtelmail.in
Thu Oct 30 14:08:25 CDT 2008


Kaup,

    Apparently, you wish to insert a blank line after every three records upto 15th record and then another blank line after the sixteenth record. Thereafter, similar cycle to be repeated from record 17 to 32 and so on.

    Sample code in report's module as given below, should get you the desired results. It would be noted that for incrementing row count variable, detail section's print event has been used instead of the format event. The latter would have led to unwanted increments in case of extra cycle of formatting caused by a calculated text box having [Pages] as part of its expression.

    Check against WillContinue property of detail section is found necessary so as to avoid phantom increment to row count variable at the end of a page.

    The suggested solution has been tested at my end on Access 2003 desktop. You might like to try it out and confirm the outcome. 

    Imp:  Please make sure that the setting [Event Procedure] appears on Event tab of properties sheet against report's open event and detail section's print event.

Best wishes,
A.D. Tejpal
------------

' Code in report's module
'==============================
' Declarations section
Private RowCount As Long
Private Const RowGrpMinor As Long = 3
Private Const RowGrpMajor As Long = 16
'---------------------------------------------

Private Sub Detail_Print(Cancel As Integer, _
                                    PrintCount As Integer)
    If Me.Detail.WillContinue = False Then
        RowCount = RowCount + 1
    End If
    
    RowCount = IIf(RowCount <= (RowGrpMajor + _
                  (RowCount \ (RowGrpMinor + 1)) + 1), _
                  RowCount, 1)
                        
    If RowCount Mod (RowGrpMinor + 1) = 0 _
                  Or RowCount = (RowGrpMajor + _
                  (RowCount \ (RowGrpMinor + 1)) + 1) Then
        Me.NextRecord = False
        Me.PrintSection = False
    Else
        Me.NextRecord = True
        Me.PrintSection = True
    End If
End Sub
'---------------------------------------------

Private Sub Report_Open(Cancel As Integer)
    RowCount = 0
End Sub
'===============================

  ----- Original Message ----- 
  From: Kaup, Chester 
  To: Access Developers discussion and problem solving 
  Sent: Wednesday, October 29, 2008 21:32
  Subject: [AccessD] Blank Lines in report


  I have some data in a table I need to display in a report. The problem is I need a blank line in the report after the 3rd, 6th, 9th, 12th, 15th and 16th record. I found some code in MS article 208696 but that is only for every nth record. The stumbling block is the last interval. Maybe I could put some blank records in the source data?

  Chester Kaup


More information about the AccessD mailing list