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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I check if a query is empty

Status
Not open for further replies.

avayaman

Technical User
Nov 6, 2002
841
CA
I am sure this is simple. I need VB code to check if the results of a query is empty or not. (In other words a report generated off it has no entries)

Paul Beddows

Consulting, Avaya/EAS implementation, Training
Vancouver, Canada
E-mail paul at natcoa.com
 
or ... use the following function to check any table or query:
Code:
[blue]Public Function NoRecords(objName As String) As Boolean
   [green]'objName: any query or table name[/green]
   NoRecords = (DCount("*", objName) = 0)
End Function[/blue]
[blue]Your Thoughts? . . .[/blue]

See Ya! . . . . . .

Be sure to see faq219-2884 [blue]Worthy Reading![/blue] [thumbsup2]
Also faq181-2886 [blue]Worthy Reading![/blue] [thumbsup2]
 
avayaman said:
In other words a report generated off it has no entries[/quote ]

you might want to look @ the nodata event
 
Thanks everyone, the first set of code did the trick

Paul Beddows

Consulting, Avaya/EAS implementation, Training
Vancouver, Canada
E-mail paul at natcoa.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top