Shows in PrintPreview but doesn't Print

G

Guest

Hi -

I have a report which is successfully suppressing the display of selected
records in Print Preview. If the record matches a certain set of criteria, I
set Cancel = True in Detail_Format().

The problem is that after Day 0 (see code below), none of the records print,
even though some can be seen in print preview.

LastDaySameDoseMethylprednisolone is a "global" variable.

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)

Cancel = False
If Me.DoseDate > 0 Then 'i.e., after Day 0.
If Me.Drug = "Methylprednisolone" Then
If Me.DoseDate <= LastDaySameDoseMethylprednisole Then
'Suppress record because it is a duplicate dose.
Cancel = True
Else
'Mark last day of duplicating records for suppression.
LastDaySameDoseMethylprednisole = CheckMethylprednisole()
Cancel = False
End If

End If
End If

End Sub

I've stepped through the above, and it seems to be executing as expected,
except for the part where it previews but does not print. Am I missing
something really basic about how Detail_Format works? Or the Cancel variable?

Thanks in Advance,

Phil Freihofner
 
J

Jeff Boyce

Phil

Any chance you could do the selection via a query, before you ever get to
the report?

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
G

Guest

Problem solved.
The "Global" variable was getting stuck at it's max value instead of being
recalculated when going from Preview to Print.
Rewriting to eliminate the Global value solved the problem.

- PF
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top