Delete tables with a certain string in their name?

H

Henrootje

I would like to delete all tables in my database that have the string
'_Importfouten' in their name.


Any suggestions no how to do this?


TIA,


Henro
 
A

Allen Browne

Function KillTables()
Dim db As DAO.Database
Dim tdx As DAO.TableDefs
Dim i As Integer

Set db = CurrentDb()
Set tdx = db.TableDefs

For i = tdx.Count - 1 To 0 Step -1
If tdx(i).Name Like "*_Importfouten*" Then
Debug.Print "Deleting " & tdx(i).Name
tdx.Delete tdx(i).Name
End If
Next
End Function
 
Top