Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Report producing error message on no data.

Status
Not open for further replies.

serino64

Programmer
Feb 25, 2003
32
US
I have serveral reports that will open when a macro is run. The Macro hangs when comes to a report that contains no data and produces the following error: "You entered an expression that has no value".

In the detail section of each report I have the following code in the On Format event. I need someway or another, maybe in the macro or the report to skip the report if there is no data so the macro can continue on to the next report.


[Blue] Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Dim ctl As Control

Set ctl = Me!SalesRevenue
If Status = "Lost" Then
ctl.FontBold = True
ctl.ForeColor = vbRed
Else
ctl.FontBold = False
ctl.ForeColor = vbBlack

End If

End Sub[/blue]

Thank You for your assistance
 
All,

I figured out what to do here. I placed the below code in the no data event which took care of the error I was having.
Thank you anyway.

Private Sub Report_NoData(Cancel As Integer)
MsgBox "There is no data for for the Washout Report during this period"
Cancel = True
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top