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!

Dealing with Empty recordsets following criteria selection

Status
Not open for further replies.

delorfra

Programmer
Mar 8, 2001
79
FR
When users select criteria for which there is no matching records, i just want to detect whether the recordset returned is empty to display the corresponding alert message :"No records found matching ..."

I have tried (before any .movefirst command) these :
If myset.eof then ...
If myset.eof and myset.bof then ..
If myset.recordcount = -1 then ..
If myset.recordcount = 0 then
If myset.absoluteposition = -1 then

And none of them seems to work all the time. While some work sometimes, it fails to work some other times.

What is the most efficient way ?
Am I bound to go for "select count(*) from mytable where mycriteria" ???

Thanks.
 
If rs.eof and rs.bof then
'No records
call msgbox("No Records Found")
else
'Records found

end if

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top