Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Automatically deleting error tables - help!

Status
Not open for further replies.

Sech

Programmer
Jul 5, 2002
137
GB
I know how to delete a table (Docmd.DeleteObject) but does anyone know how to run through all the tables of a database using code and delete all automatically generated error tables i.e. All tables which contain "_ImportErrors" in their names?
 
This will delect all tables who's names end with "_ImportErrors"

Sub mDelete()
Dim db As Database
Dim tbl As TableDef

Set db = CurrentDb
For Each tbl In db.TableDefs
If Right$(tbl.Name, 13) = "_ImportErrors" Then
DoCmd.DeleteObject acTable, tbl.Name
End If
Next

db.Close
Set db = Nothing
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top