From: Leslie M on
Good Afternoon,

I have a report which contains several subreports. The problem I'm having
is that when there is no data in the Main Report then the report will not
run. I need to be able to print this report, and I have followed numerous
suggestions on this site, but I am getting the following error...

Run-time error '2427':
You entered an expression that has no value.

Here is all of my code...

Option Compare Database

Private Sub GroupHeader0_Print(Cancel As Integer, PrintCount As Integer)

End Sub

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Cancel = (Me.txtCount > 15)
If Me.Section(0).BackColor = vbWhite Then
Me.Section(0).BackColor = 15724527
Else
Me.Section(0).BackColor = vbWhite
End If
End Sub

Private Sub Report_Close()
DoCmd.Close acForm, "frmMLUsage"
End Sub

Private Sub Report_NoData(Cancel As Integer)
' MsgBox "No records found." ' This message is optional
Dim ctl As Control
For Each ctl In Me.Section(0).Controls
ctl.Visible = False
Next
Me.NoRecs.Visible = True

End Sub

Private Sub Report_Open(Cancel As Integer)
' Set public variable to true to indicate that the report
' is in the Open event
bInReportOpenEvent = True

' Open frmMLUsage
DoCmd.OpenForm "frmMLUsage", , , , , acDialog

' Cancel Report if User Clicked the Cancel Button
If IsLoaded("frmMLUsage") = False Then Cancel = True

' Set public variable to false to indicate that the
' Open event is completed
bInReportOpenEvent = False
End Sub


I'd appreciate any suggestions you have to offer. Thank you.

--
Leslie M
From: Duane Hookom on
If there are no records returned in the main report, there is no detail
section. If you have subreports in any group header or footer or the detail
section, they won't render.

--
Duane Hookom
Microsoft Access MVP


"Leslie M" wrote:

> Good Afternoon,
>
> I have a report which contains several subreports. The problem I'm having
> is that when there is no data in the Main Report then the report will not
> run. I need to be able to print this report, and I have followed numerous
> suggestions on this site, but I am getting the following error...
>
> Run-time error '2427':
> You entered an expression that has no value.
>
> Here is all of my code...
>
> Option Compare Database
>
> Private Sub GroupHeader0_Print(Cancel As Integer, PrintCount As Integer)
>
> End Sub
>
> Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
> Cancel = (Me.txtCount > 15)
> If Me.Section(0).BackColor = vbWhite Then
> Me.Section(0).BackColor = 15724527
> Else
> Me.Section(0).BackColor = vbWhite
> End If
> End Sub
>
> Private Sub Report_Close()
> DoCmd.Close acForm, "frmMLUsage"
> End Sub
>
> Private Sub Report_NoData(Cancel As Integer)
> ' MsgBox "No records found." ' This message is optional
> Dim ctl As Control
> For Each ctl In Me.Section(0).Controls
> ctl.Visible = False
> Next
> Me.NoRecs.Visible = True
>
> End Sub
>
> Private Sub Report_Open(Cancel As Integer)
> ' Set public variable to true to indicate that the report
> ' is in the Open event
> bInReportOpenEvent = True
>
> ' Open frmMLUsage
> DoCmd.OpenForm "frmMLUsage", , , , , acDialog
>
> ' Cancel Report if User Clicked the Cancel Button
> If IsLoaded("frmMLUsage") = False Then Cancel = True
>
> ' Set public variable to false to indicate that the
> ' Open event is completed
> bInReportOpenEvent = False
> End Sub
>
>
> I'd appreciate any suggestions you have to offer. Thank you.
>
> --
> Leslie M