fingermouse
Board Regular
- Joined
- Dec 13, 2013
- Messages
- 117
Hi,
Not sure if this should be in the vba, excel or access forum but ill put it in here, hope someone can help. I should mention that I'm a complete novice in Access.
I was unable to export more than 65,000 records to excel from a table within Access using the export wizard (I unticked the formatting box but it didn't help). Someone suggested using VBA 'DoCmd.TransferSpreadsheet' function. Here is the code ive used.
I haven't had any errors in the code itself but I do get the following error upon execute:
"Run-time Error '3011': The Microsoft Access database engine could not find the object 'dbTable'. Make sure the object exists and that you spell the path name correctly. If dbTable' is not a local object, check your network connection or contact the server administrator."
So obviously I'm doing something wrong. The table 'Source Table' is the name of the table within the access database file. Am I referencing this properly or using the correct path? Any help would be much appreciated.
Cal.
Not sure if this should be in the vba, excel or access forum but ill put it in here, hope someone can help. I should mention that I'm a complete novice in Access.
I was unable to export more than 65,000 records to excel from a table within Access using the export wizard (I unticked the formatting box but it didn't help). Someone suggested using VBA 'DoCmd.TransferSpreadsheet' function. Here is the code ive used.
Code:
Option Compare Database
----------------------------------
Sub ExportToXl()
On Error GoTo ErrorHandler
Dim dbTable As String
Dim xlWorksheetPath As String
xlWorksheetPath = "\\lonfs01\home\mckellarc\"
xlWorksheetPath = xlWorksheetPath & "transfer.xls"
dbTable = "Source Table"
DoCmd.TransferSpreadsheet TransferType:=acExport, SpreadsheetType:=acSpreadsheetTypeExcel9, TableName:="dbTable", FileName:=xlWorksheetPath, hasfieldnames:=True
ErrorHandlerExit:
Exit Sub
ErrorHandler:
MsgBox "Error No: " & Err.Number & ";Descriptions; " & Err.Description
Resume ErrorHandlerExit
End Sub
I haven't had any errors in the code itself but I do get the following error upon execute:
"Run-time Error '3011': The Microsoft Access database engine could not find the object 'dbTable'. Make sure the object exists and that you spell the path name correctly. If dbTable' is not a local object, check your network connection or contact the server administrator."
So obviously I'm doing something wrong. The table 'Source Table' is the name of the table within the access database file. Am I referencing this properly or using the correct path? Any help would be much appreciated.
Cal.