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

Can you tell if a query returns a value or not? 1

Status
Not open for further replies.

striker73

MIS
Jun 7, 2001
376
US
As far as VBA, is there any way to tell whether or not a query returned a value or not? I have a form that applies filters to a query and then outputs a mailmerge Word document. When there isn't anything selected in the query, then Word opens and closes and that's it. I want to be able to tell my user that his/her search qualifications didn't return anything. Any ideas? Thanks!!!
 
Something like this maybe?

[tt]
Dim NbrOfRecords

NbrOfRecords = DCount("*","MyQueryName")

If NbrOfRecords < 1 Then
MsgBox &quot;No Records!&quot;
Exit Sub
End If
[/tt]

HTH Joe Miller
joe.miller@flotech.net
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top