Export to spreadsheet error, help please

  • Thread starter Thread starter ljg
  • Start date Start date
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.
 
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
 
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
 
Back
Top