Can you automatically delete import error tables using a macro?

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?
 
J

Jerry Whittle

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.
 

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