I have a form that on the button click runs a query that outputs to an Excel spreadsheet. Is there an easy was to tell if the query produces no data so that so that I can display a msgbox instead?
If DCount(fld,src,criteria)>0 then
'The query is returning results so you can proceed with the Excel export
else
'No results returned so inform your users
end if
.....
You will have to exchange
<Primary Key> with the name of your Primary Key
<Source Query> with your query name.
This method assumes you are using a Saved Query.
Alec Doughty
Doughty Consulting P/L
"Life's a competition. Play hard, but play fair"
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.