error using .DoCmd.TransferSpreadsheet acImport IN EXCEL

K

KayC

Hi I am running Office2000
I have the below VBA code in an Excel Loop referencing Access

The below will import data from a xls to an mdb table, the xls data to
import changes for every loop.
When I look at the access table it has imported the first dataset n
times rather than import the n datasets into the table once

Can anyone help - I am assuming it may be a refresh issue with the
object link but would be grateful for some direction

Thanks

Kay

Sub ACCESS_Import(strid As String)

Dim appAccess As Access.Application
Dim strDB As String
Dim strXL As String

strDB = mdb
strXL = "xls

Application.ScreenUpdating = False
Set appAccess = New Access.Application
With appAccess
.OpenCurrentDatabase (strDB)
' DoCmd.SetWarnings False
.DoCmd.TransferSpreadsheet acImport, ,
"750_pnl_comparison", strXL, True, strid
' DoCmd.SetWarnings True
.CloseCurrentDatabase
.Quit
End With
Set appAccess = Nothing

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top