Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Exporting to Excel using TransferSpreadsheet Expand / Collapse
Author
Message
Posted Tuesday, July 29, 2014 3:35 PM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Monday, August 25, 2014 5:40 AM
Points: 150, Visits: 393
I have the code below that exports data to an excel file and creates a tab for each query ran. If It runs more than 5 TransferSpreadsheet commands then It error outs with Error 3011. It is not consistent. Sometimes it runs but other times it fails. It is in a Loop and it runs the line below 6 times and it bombs on me. Can't figure it out....


DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel12Xml, "Export_Query", Forms(currentform).Browse_LocationLabel.Caption & "\" & rs_grpid![GroupID] & "_" & rs_grpid![VendorName] & "_" & rs_grpid![VendorNumber] & ".xlsx", True, a_arr(i_arr)



Post #1597513
Posted Saturday, August 2, 2014 8:21 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Sunday, September 14, 2014 11:30 AM
Points: 146, Visits: 535
Your 3011 error indicates that Access cannot find the object being specified in the statement. Since you are using variables, I would suspect that the path to where you are trying to export the Excel workbook to doesn't exist. To verify that you can put in some code to trap the error and display the variables being used to construct the path.

If that turns out not to be the case, another more remote possibility is an issue with the TransferSpreadsheet method in your version. Export capabilities were reworked extensively in 2010 and were problematic until SP1 was released, but they still seem to experience occasional issues even with 2013 in my experience.


Wendell
Colorful Colorado
You can't see the view if you don't climb the mountain!
Post #1598937
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse