Problem forced page-break in report after fixed number of header-sections
In Access97 I want to create a report with this structure (report-sections):
-Header-Text 0
--Header-Text 1: this section has a 'tally' (Textbox with running total to give each section a unique numer)
---Detail
--------
Example report (Now):
*pag.1:
-H.0
--H.1-1: A
---Det.1-1-1
---Det.1-1-2
---Det.1-1-3
--H.1-2: A
---Det.1-2-1
---Det.1-2-2
--H.2-1: B
---Det.2-1-1
---Det.2-1-2
*pag.2:
--H.2-2: B
---Det.2-2-1
---Det.2-2-2
--------
But what I want is that on every page always appear 2 sections of Header-Text 1, so the above example should be this:
--------
Example report (Required):
*pag.1:
-H.0
--H.1-1: A
---Det.1-1-1
---Det.1-1-2
---Det.1-1-3
--H.1-2: A
---Det.1-2-1
---Det.1-2-2
*pag.2:
--H.2-1: B
---Det.2-1-1
---Det.2-1-2
--H.2-2: B
---Det.2-2-1
---Det.2-2-2
--------
I thought I could do this with the tally/counter in section Header-Text 1, with this code:
--------
Private Sub HeaderTxt1_Format(Cancel As Integer, FormatCount As Integer)
Dim i As Integer
i = CInt(Me.txt_Tally.Value)
If (i Mod 2) = 0 Then
Me.HeaderTxt1.ForceNewPage = 2
Else
Me.HeaderTxt1.ForceNewPage = 0
End If
End Sub
--------
But this doesn't work well, the page-breaks are not put on the places I want, I have e.g. a page with only header-text and the detail-text on another page (in stead of having them together, on the same page). I also tried to move the code above to the Format-event of the Detail-section, but this also doesn't work well. Could anyone please tell me what I'm doing wrong? .