Code to delete import errors table

afs24

Board Regular
Joined
Sep 26, 2002
Messages
237
Do you see anything wrong with this code? I'm trying to delete all tables that with the Import Errors. Thank you.


Option Compare Database

Public Sub DeleteImportErrorTables()
' Deletes Import Error Tables

Dim tdf As TableDef - IT'S TELLING ME THERE IS AN ISSUE HERE
Dim tblName As String
Dim i As Long

For Each tdf In CurrentDb.TableDefs
tblName = tdf.Name
For i = Len(tblName) To 1 Step -1
If Not (IsNumeric(Mid(tblName, i, 1))) Then Exit For
Next i
If Right(Left(tblName, i), 12) = "ImportErrors" Then
CurrentDb.TableDefs.Delete tdf.Name
End If
Next tdf

End Sub
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off

Forum statistics

Threads
1,221,604
Messages
6,160,747
Members
451,670
Latest member
Peaches000

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top