Hi Fred,
Sorry about that, the MoveCount is a variable that increments by 1 every
detail line and then resets back to 0 when the page header formats.
I tried doing the pagebreak visible thing, but still have the same result.
Here's all the report code so you can see everything that's going on;
Dim MoveCount As Integer
Dim LastMoveCount As Integer
Private Const intLineCnt As Integer = 12 'CalcLinesToMove()
Private Sub BreakFooter_Format(Cancel As Integer, FormatCount As Integer)
End Sub
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Me.MoveLayout = True
Me![PageBreakName].Visible = (MoveCount Mod 12 = 0)
If MoveCount < intLineCnt Then
Me.NextRecord = False
' Me.MoveLayout = True
'Me.PrintSection = False
MoveCount = MoveCount + 1
Else
Me.NextRecord = True
' Detail.ForceNewPage = 2
' Me.MoveLayout = True
'Me.PrintSection = True
End If
Exit Sub
End Sub
Private Sub PageHeaderSection_Format(Cancel As Integer, FormatCount As
Integer)
MoveCount = 0
PageBreakName.Visible = False
'Detail.ForceNewPage = 0
'Detail.ForceNewPage = 0
End Sub
Private Sub PageHeaderSection_Print(Cancel As Integer, PrintCount As
Integer)
Me![PageBreakName].Visible = False '(MoveCount Mod 12 = 0)
End Sub
It's driving me nuts at this point, this shouldn't be that hard! ;)
"fredg" <fg******@example.invalid> wrote in message
news:tw****************************@40tude.net...
On Fri, 12 May 2006 03:18:55 GMT, Rico wrote:
Hello,
I'm looking for a way to force a pagebreak in code. I'm having a tough
time, the first page formats properly until the condition is met and then
forces a new page. The problem is, every page after that forces a new
page
after a single record. I'm trying to force the page after 12 records.
The
code is pretty simple. I have a footer called "BreakFooter" that i have
associated with the ID field, so each detail record is unique. For
simplicity's sake, I've replaced the variable with hard coded numbers;
If MoveCount >= 12 Then
BreakFooter.ForceNewPage = 2
Else
BreakFooter.ForceNewPage = 0
End If
Most of the searches I get return information on how to force a page
break
using Grouping and Sorting, but no code really.
Any help would be great.
Thanks!
That's what your code is telling it to do.
What is MoveCount? A Counter control in the Detail section?
Try:
If [MoveCount] Mod 12 = 0 Then
BreakFooter.ForceNewPage = 2
Else
BreakFooter.ForceNewPage = 0
End If
I would have simply added a PageBreak control to the detail section.
Code the Detail Format event:
Me![PageBreakName].Visible = Me![MoveCount] Mod 12 = 0
It would force a page break after each 12 records.
--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail