July 29, 2014 at 3:35 pm
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)
August 2, 2014 at 8:21 am
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!
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply