Can you automatically delete import error tables using a macro?

  • Thread starter Thread starter Troy21
  • Start date Start date
T

Troy21

I have several databases that import data and create error tables due to null
values, etc..... I can't change the source data or the database table field
formats to prevent these tables from being created, so I want to
"automatically" delete these error tables wiwthout human intervention. Any
ideas?
 
Modified a little from: http://support.microsoft.com/?kbid=210307

Function DeleteImportErrorTables()
Dim db As DAO.Database, t As DAO.TableDef, i As Integer
Set db = CurrentDb()
For i = db.TableDefs.Count - 1 To 0 Step -1
Set t = db.TableDefs(i)
If t.Name Like "*ImportErrors" Then
db.TableDefs.Delete t.Name
End If
Next i
db.Close
End Function

Put something like the above on the Timer event in your opening form.
 
Back
Top