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.
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.