GenieTR
IS-IT--Management
- Jan 21, 2003
- 28
Is there a way to stop the report from displaying or printing, when there is no data. I have created a dialog form, where there are two options: first option is
All and the second option is specific which have a combo box for the user to select. On the report there is a nodata event option, the code is:
Private Sub Report_NoData(Cancel As Integer)
On Error Goto Report_NoData_Err
If DCount("*",Me.RecordSource)=O Then
MsgBox "No Data for this report",vbOKOnly,"Sorry No Data"
Cancel = True
End If
Report_NoData_Exit:
Exit Sub
Report_NoData_Err:
MsgBox Error$
Resume Report_NoData_Exit
End Sub
It still display the blank report with only the heading.
Thanks in advance
All and the second option is specific which have a combo box for the user to select. On the report there is a nodata event option, the code is:
Private Sub Report_NoData(Cancel As Integer)
On Error Goto Report_NoData_Err
If DCount("*",Me.RecordSource)=O Then
MsgBox "No Data for this report",vbOKOnly,"Sorry No Data"
Cancel = True
End If
Report_NoData_Exit:
Exit Sub
Report_NoData_Err:
MsgBox Error$
Resume Report_NoData_Exit
End Sub
It still display the blank report with only the heading.
Thanks in advance