how can i delete in access 2013 with vba every table that starts with Backup_"

hi

I am looking for a way to delete with vba any table that begins with "Backup_",

thanks
bill201Asked:
Who is Participating?
 
peter57rCommented:
Backup before testing!!!!!!!!!!

Sub deltab()
Dim tdf As DAO.TableDef
For Each tdf In CurrentDb.TableDefs
If Left(tdf.Name, 7) = "backup_" Then
DoCmd.DeleteObject acTable, tdf.Name
Next tdf

End Sub
0
 
bill201Author Commented:
Thanks a lot
Excellent code only need to add end if
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.