Delete tables with a certain string in their name?

  • Thread starter Thread starter Henrootje
  • Start date Start date
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
 
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
 

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

Back
Top