OK,
Do the following in the code behind the button.
.....
dim fld as string
dim src as string
dim criteria as string
fld = "[[<Primary Key>]]"
src = "[[<Source Query>]]"
criteria = ""
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"