Transfer Spreadsheet to Existing Excel Worksheet

Nphp0729

New member
Local time
Today, 14:12
Joined
Dec 18, 2009
Messages
6
I used a converted Macro and made an adjustment to the code so the Access Table would go to an Existing Worksheet. It runs and works fine once or twice and then I receive an error stating: The Microsoft Jet Database Engine could not find the database ''. Make sure the object exists and you spell the name correctly.
I need the table to automatically transfer over when the button on the form is clicked.

Option Compare Database
'------------------------------------------------------------
' TransferMasterTabletoExcel
'
'------------------------------------------------------------
Function TransferMasterTabletoExcel()
On Error GoTo TransferMV22TabletoExcel_Err
' Transfer Master Table to Excel
DoCmd.TransferSpreadsheet acExport, 8, "Master Table", "J:\MyDocs\Inventory\REPORT\TableReportDistribution.xls", True, "MasterInventoryTable!A:AZ"
TransferMasterTabletoExcel_Exit:
Exit Function
TransferMasterTabletoExcel_Err:
MsgBox Error$
Resume TransferMasterTabletoExcel_Exit
End Function
 
Not sure if it makes a difference but try...

DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "Master Table", "J:\MyDocs\Inventory\REPORT\TableReportDistribution.xls", True, "MasterInventoryTable!A:AZ"

And you are sure the "Master Table" exists and is not being deleted?
 

Users who are viewing this thread

Back
Top Bottom