schniggeldorf
Registered User.
- Local time
- Today, 07:34
- Joined
- Jan 7, 2013
- Messages
- 22
Hi:
I am trying to write a Sub in Excel that would copy a range of cells from a Excel worksheet, and export them as a new table in an Access Database. My code, in Excel VBA is as follows:
The code compiles OK, but when I try to run it I get error 3073 - "Operation must use an updatable query". I've searched the web, but haven't found anything that quite fits my situation.
Can anybody help me figure this out?
Thanks.
I am trying to write a Sub in Excel that would copy a range of cells from a Excel worksheet, and export them as a new table in an Access Database. My code, in Excel VBA is as follows:
Code:
Public Sub ExportWsToAccessTable()
Dim FullOutputPath As String
Dim objAccess As Access.Application
Dim Range As String
Dim DestTable As String
Dim HasFieldNames As Boolean
FullOutputPath = "S:\NEURO\PUBLIC\IMATCH\Database\IMATCH outcomes database.accdb"
Set objAccess = New Access.Application
DestTable = "tblKpImportPre"
HasFieldNames = True
Range = "a1:eu9"
Call objAccess.OpenCurrentDatabase(FullOutputPath)
objAccess.Visible = True
objAccess.DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel12, DestTable, FullOutputPath, HasFieldNames, Range
objAccess.CloseCurrentDatabase
Set objAccess = Nothing
End Sub
The code compiles OK, but when I try to run it I get error 3073 - "Operation must use an updatable query". I've searched the web, but haven't found anything that quite fits my situation.
Can anybody help me figure this out?
Thanks.
Last edited: