Need to ignore import errors

User avatar
Abraxus
3StarLounger
Posts: 254
Joined: 01 Mar 2010, 17:34
Location: Blue Springs, MO

Need to ignore import errors

Post by Abraxus »

I have some code that is used to import an Excel file of my company's employees.

Code: Select all

On Error Resume Next
    DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel12, "EmployeeListing", strCurrentDirectory & "Active Employee Listing PIT-Daily.xlsx", True
    
I'm getting the attached error and I simply want Access to know that it's always ok to import regardless of the error instead of asking me.

Is it possible to do so?
You do not have the required permissions to view the files attached to this post.
Morgan

User avatar
HansV
Administrator
Posts: 78471
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Need to ignore import errors

Post by HansV »

What happens if you insert

Code: Select all

    DoCmd.SetWarnings False
above the DoCmd.TransferSpreadsheet line, and

Code: Select all

    DoCmd.SetWarnings True
below it?
Best wishes,
Hans

User avatar
Abraxus
3StarLounger
Posts: 254
Joined: 01 Mar 2010, 17:34
Location: Blue Springs, MO

Re: Need to ignore import errors

Post by Abraxus »

Well that was too easy...I thought On Error Resume Next would cover it.

Thank you so much!
Morgan