capture error file names when importing

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Minh Le (MinhLe_at_discussions.microsoft.com)
Date: 03/09/05


Date: Wed, 9 Mar 2005 06:31:16 -0800

Hi all,

I would like to capture error files that are failed to import. Below is my
code
Dim myfile
    Dim mypath
    mypath = "C:\Documents and Settings\"
    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.TransferSpread*** acImport, 8, "PR", mypath & myfile, True
         
I need some code here to capture files that are failed.I don't know how to
write the code to check for error files.

 if DoCmd.TransferSpread*** acImport, 8, "PR", mypath & myfile, True is
not imported, then
How do i check the line above for error file???
                 
                 MsgBox "Transfer Failed: " & vbCrLf & "XLS: " & myfile&
    
            
        End If
        myfile = Dir
                   
    Wend


Quantcast