Testing whether a query returns no records

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Using Access XP (2002)
What is the best way in VBA, to determine if "qryGroupSelect" returns no
records.

I am running a report that will always return some data, however, if one of
the subreports based on "qryGroupSelect" returns no records, I will refuse to
open the report.
 
Create a recordset and run it prior to running the report.

Check for .EOF and .BOF to determine if you want to open the report or
not....

Dim rst as Recordset
Set rst = OpenQuery....
With rst
If Not .EOF and Not .BOF Then
'rst returned records
End if
End With

--
Troy

Troy Munford
Development Operations Manager
FMS, Inc.
www.fmsinc.com


Using Access XP (2002)
What is the best way in VBA, to determine if "qryGroupSelect" returns no
records.

I am running a report that will always return some data, however, if one of
the subreports based on "qryGroupSelect" returns no records, I will refuse
to
open the report.
 
Back
Top