Skipping pages with a Zero on the Report

  • Thread starter Thread starter Steven M. Britton
  • Start date Start date
S

Steven M. Britton

I am trying to make a button that after I click it it will
preview my report. But I am trying to make the report not
display or print when the detail Qty_To_Ship is equal to
zero.

I have a query that runs and gathers the info required for
the report, the query has a cacluated field that take the
qty_Billed minus the Qty_To_Ship, if this value is zero it
does display in the query which doesn't bother me.

What I need to some code or direction on how to make the
report rpt_PackingSlip that doesn't print ones when that
value is equal to zero.

-Steven M. Britton
 
Steven:

Here is a snippet of code I've used to accomplish the very
same thing.

You'll need to place these lines of code just prior to
your "End Sub" statement and part of the "Error TYrapping
code" of the "OnClick" event of the button used to run the
report. It may need to be modified to meet your needs:

................Code Follows...............

If Err.Number = 2501 Then
Resume Next
Else 'If Err.Number = 2501 Then
MsgBox "There was No Data To Display. Please,
Click Close And Reset Your Criteria"
Resume Exit_cmdPrintRpts_Click
End If

...............Code End...................

It all has to do with the Access internal Error #2501
generated when no data is found for the report.

Hope this helps.
 
Back
Top