suppressing certain pages from printing

  • Thread starter Thread starter VesG
  • Start date Start date
V

VesG

What I have is a 2-page report. I'm using 2 subreports
that basically print out the same data. The first
subreport is used to print when there are <=2 records, and
the second subreport prints on the next page if there are
2 records. I have the second subreport's position pass
the
bottom margin, so therefore it prints on the next page
(which is what I want it to do). The problem is because
it is positioned there, I will always have 2 pages even
when I only want one (which is when there are <= 2 records
to display). How do I stop the second page from printing
when its <=2 records?

Thanks

Vesg
 
Ves:

What I'd do is to:

1.) Move the second sub to a group footer and then set the group footer's
force new page property to true. If there's no groups in the report,
create a simple one based on some field that will encompass all the records.

2.) Then in your report's On Open event, open your report's underlying
recordset in code as a snapshot or read only recordset and grab the record
count and store it in a module level variable.

3.) In the new Group footer's On Print event, add code like this:

If lngMyRecordCounter <=2 Then
Me.PrintSection = False
Me.MoveLayout = True
End if

That will cause Access to skip printing the group footer (and paginating,)
when there are only one or two records.

HTH
 
Back
Top