Trap cancel button

  • Thread starter Thread starter papou
  • Start date Start date
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
 
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
 
Back
Top