Cancel Print if Subreport not visible

  • Thread starter Thread starter CJ
  • Start date Start date
C

CJ

Hi

I have a subreport that is set to be invisible if it does not contain any
data. This had to be done because of another report that the sub is used on.

Anyway, how do I tell a main report to show a message box and cancel
printing if this particular subreport is not visible.

The code I have is as follows, but is not working:

If (Reports!rsubPumpsInStock.Visible = False) Then
MsgBox "No pumps in stock, cancelling report printing",
vbExclamation, ""
DoCmd.CancelEvent
End If

I'm not sure which report event to use either.....

Thanks
CJ
 
My mistake, the code that I have is as follows:

Private Sub Report_Activate()
If (Me!rsubPumpsInStock.Visible = False) Then
MsgBox "No pumps in stock, cancelling report printing",
vbExclamation, ""
DoCmd.CancelEvent
End If
End Sub

Thanks again,
CJ
 
Back
Top