Gustav Brock
gustav at cactus.dk
Thu Feb 20 11:06:00 CST 2003
Hi Charlotte
> I seem to recall there being an example of this in one of the sample
> database, probably Solutions. Depending on the version of Access
> you're using, it my be on the Office CD or downloadable from Microsoft.
That's right - it was Report Samples 97, rptsamp7.mdb:
"How to print a constant number lines per group"
They tell this code only works for 15 lines or less - I'll leave that
for Rocky - guess he easily can kill that cat:
<code>
Option Compare Database 'Use database order for string comparisons
Option Explicit
Global TotCount As Integer
' Call the SetCount() function from the group header section's
' OnPrint property using the syntax: =SetCount(Report)
' 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
ElseIf TotCount > TotGrp And TotCount < 15 Then
R.NextRecord = False
R![ProductName].Visible = False
End If
End Function
Function SetCount(R As Report)
TotCount = 0
R![ProductName].Visible = True
End Function
</code>
/gustav