"how do i display files that failed to import into MS Access table

D

D Minh Le

I have tried to import spreadsheets (mutliple files) into MS Access.
Sometimes, there is (are) file(s) not imported because of data error in
excel. Thus; it can not be imported. So i would like to capture files that
failed to import such as i can open the excel file(s) to see what is wrong
with it(them). My code is


Dim myfile
Dim mypath
mypath = "C:\Documents and Settings\Tally_sheets\"
myfile = Dir(mypath & "*.xls")
While myfile <> ""
'this will import ALL the excel files (one at a time, but automatically)
in this folder. Make sure that's what you want.

DoCmd.TransferSpreadsheet acImport, 8, "PR", mypath & myfile, True
I would like some code here to capture error files. Please help
I would like the failing files to be display on the screen, so i know
what file(s) to check for.

myfile = Dir


MsgBox "it's done", vbOKOnly, "It's a test"

Wend
 

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