Transferspreadsheet fails to create table the second time I use it

C

Carol Chisholm

I'm importing a range called Data from a series of Excel files into an
Access DB.
I re-use a table called data, which I delete just before calling
TransferSpreadsheet:

My filenames are loaded into an array:

For o = m To 1 Step -1
fileCurrFile = FileArray(o)
....
DoCmd.DeleteObject acTable, "Data"
On Error GoTo Error_ImportData
DoCmd.SetWarnings True
DoCmd.TransferSpreadsheet , , "Data", fileCurrFile, False, "Data"
....
Next

On the first iteration it work fine, the second one fails to import
anything.

Each individual file will import if it is the first one, but not if it
is the second one, so I think the problem is with the create, delete,
re-create table sequence.
 

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