Export to spreadsheet error, help please

L

ljg

I am trying to Export to a spreadsheet using the following code, but I keep
getting error

"Run-Time error '2302' Can't save the output data to the file you've
selected."

This is my code:

DoCmd.OutputTo acOutputQuery, "propertyrequest", acFormatXLS,
"C\datastream\export_data\Property" & "_" & UsrName & ".xls"

I am assuming its the file format? I am using Access 2007, in a 2002 - 2003
format and using Excel 2007 set to save in Excel 97 - 2003 format.

I am running Vista Ultimate.

Any help would be most welcome.
 
J

Jeanette Cunningham

Maybe access can't find the path and folder to save the file in?
Try using a simple folder as a test like this:
"C:\MyTest.xls"

Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia
 
R

Ron2006

That is where I would check also.

I know it is not impossible that directory names have an underscore as
part of the name, but it seems a bit unusual.
Also there is usually a colon just to the right of the drive letter.

Perhaps "C\datastream\export_data\Property" & "_" & UsrName & ".xls"

should be "C:\datastream\export data\Property " & UsrName & ".xls"

The first thing I would do is check the colon
after that check about spaces instead of underscores.

Ron
 

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