
Originally Posted by
ajetrumpet
For example, enclose all of you text in the post below this line:in [CODE] tags. Indentation wouldn't hurt either, so it doesn't look jumbled. I personally don't have time right now to read through it all and try to assist, but this will give you a better chance at getting an answer from someone in the community.
How to use tags:
https://www.accessforums.net/misc.php?do=bbcode#code
Thanks. Here it goes:
Code:
Option Compare Database
Option Explicit
Dim rpt As Report
Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
On Error GoTo errorHandler
Set rpt = Reports(Me.Name)
Call PrintLines(rpt, [TotGrp])
Exit Sub
errorHandler:
MsgBox Err.Number & " - " & Err.Description, vbInformation, strErrorLabel_pub
End Sub
Private Sub GroupHeader0_Print(Cancel As Integer, PrintCount As Integer)
On Error GoTo errorHandler
Set rpt = Reports(Me.Name)
Call SetCount(rpt)
Exit Sub
errorHandler:
MsgBox Err.Number & " - " & Err.Description, vbInformation, strErrorLabel_pub
End Sub
Private Sub Report_Activate()
On Error GoTo errorHandler
Set rpt = Reports(Me.Name)
Call SetCount(rpt)
Call PrintLines(rpt, [TotGrp])
Exit Sub
errorHandler:
MsgBox Err.Number & " - " & Err.Description, vbInformation, strErrorLabel_pub
End Sub
Private Sub Report_NoData(Cancel As Integer)
On Error GoTo errorHandler
MsgBox "Sorry, there is not data to report", vbInformation, "Print Request Cancelled"
Cancel = True
Exit Sub
errorHandler:
MsgBox Err.Number & " - " & Err.Description, vbInformation, strErrorLabel_pub
End Sub
' Call the SetCount() function from the group header section's
' OnPrint property using the syntax: =SetCount(Report)
Function SetCount(R As Report)
TotCount = 0
R![col1].Visible = True
R![col2].Visible = True
R![col3].Visible = True
R![col4].Visible = True
R![col5].Visible = True
R![col6].Visible = True
R![col7].Visible = True
R![col8].Visible = True
R![col9].Visible = True
End Function
' Call the PrintLines() function from the detail section's OnPrint
' property using the syntax: =PrintLines(Report,[TotGrp]).
Function PrintLines(R As Report, TotGrp)
TotCount = TotCount + 1
If TotCount = TotGrp Then
R.NextRecord = False
If TotGrp >= 8 Then
R.MoveLayout = False
Else
R.MoveLayout = True
End If
ElseIf TotCount > TotGrp Then
If TotCount < 8 Then
R.NextRecord = False
R.MoveLayout = True
R![col1].Visible = False
R![col2].Visible = False
R![col3].Visible = False
R![col4].Visible = False
R![col5].Visible = False
R![col6].Visible = False
R![col7].Visible = False
R![col8].Visible = False
R![col9].Visible = False
End If
Else
R.MoveLayout = True
R.NextRecord = True
End If
End Function