In VBA, how to I find out, upon open of a report, if any records were returned?
I have a report which has a query setup in the Report > Record Source property. It works fine, but there's a situation where I'll need to know if NO records are returned from that query when the report is opened.
Here's the script:
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
If Val(Format(Nz(Me.EstDueDate, "1/1/3000"), "yyyymmdd")) <= Val(Format(Me.txtDate, "yyyymmdd")) Then
'MsgBox (Me.txtSR)
Me.lblPastDue.Visible = True
Else
Me.lblPastDue.Visible = False
End If
End Sub
So before the first IF, I'll need to put another IF statement to find out if any records are returned. If none are returned, this script breaks unless I put in that IF.
Thanks in advance to all who reply!