Trap cancel button

P

papou

Hi all
How to trap the cancel button with the following line?
DoCmd.OutputTo acOutputQuery, "Rq_Doublons", "MicrosoftExcel(*.xls)", "",
False, ""
TIA
Regards
papou
 
T

TC

Does the cancel cause a runtime error? If so, yo could catch it with an On
Error statement:

on error resume next
docmd.outputto ....
if err.number = 0 then
' no error occurred.
else
' an error occurred.
msgbox err.description ' (or whatever else you wanted here)
endif
on error goto 0

HTH,
TC
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top