Testing whether a query returns no records

J

jonefer

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.
 
T

Troy

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.
 
P

PC Datasheet

If DCount("*","qRyGroupSelect") = 0 Then
Msgbox "Query Returns No Records"
End If
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top