I've looked through the past threads and none seemed to provide any insight to my situation. I'm new to the OutputTo command. I first tested it with a standalone macro. Once working, I created some code to execute the macro from a form with the database window hidden. The macro worked fine. I then have tried to run the command from vba (so that I may easily alter the output location and file name on the fly). I'm stuck on the 2046 error. Thinking there might be a problem with the variable stDocName, I tried the the report name as a quoted string -- still get the error.
Application.Echo False
DoCmd.Hourglass True
HideDatabaseWindow False
' DoCmd.RunMacro "OutPutRTF"
DoCmd.OutputTo acOutputReport, stDocName, _
acFormatRTF, _
"D:\Office Developer Projects\DatabaseApplication\Devlp_mdb\Access2002\Version3.x\Expenses.rtf"
Application.Echo True
HideDatabaseWindow True
DoCmd.Hourglass False
Application.Echo False
DoCmd.Hourglass True
HideDatabaseWindow False
' DoCmd.RunMacro "OutPutRTF"
DoCmd.OutputTo acOutputReport, stDocName, _
acFormatRTF, _
"D:\Office Developer Projects\DatabaseApplication\Devlp_mdb\Access2002\Version3.x\Expenses.rtf"
Application.Echo True
HideDatabaseWindow True
DoCmd.Hourglass False