Cant save data to file selected

G

Guest

Greetings all. I have been trying to get the acOutputto command to work for
some time now, and I can not find the answer here or on google. My report
name is 'ODN Schedule', the code is as follows:

stDocName = "ODN Schedule"
DoCmd.OutputTo acReport, "ODN Schedule", acFormatXLS, "C:\temp\", True

When I hit the command button to run it a dialog box pops up saying "Now
outputting to myfilename", but then an error message pops up saying "access
can't save data to the file you've specified." I want it to open the file
automatically. If this is not possible it is okay to save it to the file I
specify. Do I need to specify a name for the file? C:\...\Desktop\ODN
Schedule.xls? Thank you in advance. I am using Access 2003 in 2000 format,
and SQL2K
 
N

Norman Yuan

Yes, you do need to specify a full file name, not a folder name as you did.
In you code, since Access cannot save output as "C:\Temp\" (because it is
not a valid file name), hence you got the error. The file name should be
something like "C:\Temp\theExcelFile.xls".
 

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