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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DoCmd.OutputTo Error 2501 "The output action is cancelled by the user".

Status
Not open for further replies.

lameid

Programmer
Jan 31, 2001
4,207
0
0
US
I received the Error 2501 The output action is cancelled by the user on a seemingly correct DoCmd.OutputTo line.

I was dumbfounded and never found any solution that seemed to fit with Google.

The issue was my variable value had an invalid file name.

To make me even crazier the bad file name was caused because a tab (ASCII 9 or CHR(9)) had some how made it into data and was used to concatenate the file name.
So when I did a debug.print of the file name variable to the immediate window, it converted the tab to spaces so when I copied it and performed the steps manually it would work.

Where did the tab come from? My guess is the user copied the value from a house web application and picked up a spurious tab. Now on that control, I replace CHR(9) with "" on after update.

I decided to post so that this may save you hours looking for the stupid.

I saw it in Access 2016 32 bit on Windows 10... I bet this could happen in any version but mentioning for completeness.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top