[AccessD] Force a new page in code

A.D.TEJPAL adtp at airtelbroadband.in
Fri Aug 31 09:52:35 CDT 2007


Jim,

    For conditional page break, ForceNewPage property can be manipulated in format event of the section concerned. Sample code in detail section's format event, as given below, will force a page break after every two records in the group. TxtCountGrp is a count tracking text box for the group.

    Note:
    (a) Use of Else clause is always necessary, otherwise after the condition is once met, the break will keep get applied for each record.
    (b) Different values that can be assigned to ForceNewPage property, and implications thereof, are explained in HELP.

    If no conditions are involved, ForceNewPage property can be set permanently in design view (Format tab of properties dialog box for the pertinent section).

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

================================
Private Sub Detail_Format(Cancel As Integer,  _
                                    FormatCount As Integer)
    If Me.TxtCountGrp Mod 2 = 0 Then
        Me.Detail.ForceNewPage = 2    ' Pg break after section
    Else
        Me.Detail.ForceNewPage = 0    ' No pg break
    End If
End Sub
================================

  ----- Original Message ----- 
  From: Jim Lawrence 
  To: 'Access Developers discussion and problem solving' 
  Sent: Tuesday, August 28, 2007 11:49
  Subject: [AccessD] Force a new page in code


  Hi all:

  Is there a way to force a new page in Access reports under program control? 

  TIA
  Jim 


More information about the AccessD mailing list