B
Bette
Any help is greatly appreciated.
The code below works fine to run a report given date
range input. I use it on a lot of reports. The problem is
I would like to suppress the report when there is no
data, which now displays error. It works fine, its just
not "clean".
How do I prevent a report when its empty and give the
user a "no data" message?
Thanks,
Bette
This is a command button on an unbound form that opens a
form for date input.
It assigns a code number for the report [rpt0 Cancels].
The report is run for the dates input here.
Private Sub btnCancelsSummary_Click()
On Error GoTo err_btnCancelsSummary_Click
DoCmd.OpenForm "frm0 GetDates"
forms![frm0 GetDates].FormNum = 81
Me.Visible = False
exit_btnCancelsSummary_Click:
Exit Sub
err_btnCancelsSummary_Click:
MsgBox Err.Description
Resume exit_btnCancelsSummary_Click
End Sub
This is a command button on [frm0 GetDates] that accepts
the report's date range as input.
If//EndIf statement repeats for all reports that uses
[frm0 GetDates] for date range input.
Private Sub btnAcceptDates_Click()
On Error GoTo Err_btnAcceptDates_Click
Dim stDocName As String
If Me.FormNum = 81 Then
stDocName = "rpt0 Cancels"
DoCmd.OpenReport stDocName, acPreview
DoCmd.RunCommand acCmdFitToWindow
Me.Visible = False
End If
Exit_btnAcceptDates_Click:
Exit Sub
Err_btnAcceptDates_Click:
MsgBox Err.Description
Resume Exit_btnAcceptDates_Click
End Sub
The code below works fine to run a report given date
range input. I use it on a lot of reports. The problem is
I would like to suppress the report when there is no
data, which now displays error. It works fine, its just
not "clean".
How do I prevent a report when its empty and give the
user a "no data" message?
Thanks,
Bette
This is a command button on an unbound form that opens a
form for date input.
It assigns a code number for the report [rpt0 Cancels].
The report is run for the dates input here.
Private Sub btnCancelsSummary_Click()
On Error GoTo err_btnCancelsSummary_Click
DoCmd.OpenForm "frm0 GetDates"
forms![frm0 GetDates].FormNum = 81
Me.Visible = False
exit_btnCancelsSummary_Click:
Exit Sub
err_btnCancelsSummary_Click:
MsgBox Err.Description
Resume exit_btnCancelsSummary_Click
End Sub
This is a command button on [frm0 GetDates] that accepts
the report's date range as input.
If//EndIf statement repeats for all reports that uses
[frm0 GetDates] for date range input.
Private Sub btnAcceptDates_Click()
On Error GoTo Err_btnAcceptDates_Click
Dim stDocName As String
If Me.FormNum = 81 Then
stDocName = "rpt0 Cancels"
DoCmd.OpenReport stDocName, acPreview
DoCmd.RunCommand acCmdFitToWindow
Me.Visible = False
End If
Exit_btnAcceptDates_Click:
Exit Sub
Err_btnAcceptDates_Click:
MsgBox Err.Description
Resume Exit_btnAcceptDates_Click
End Sub