Link to home
Start Free TrialLog in
Avatar of smidgen
smidgen

asked on

Delete Table Module

I'm running a module in access to delete a table each day but I have more than one table that needs to be deleted
the code is;

Public Function DeleteTable()
Dim tdf As TableDef
For Each tdf In CurrentDb.TableDefs
  If tdf.Name = "B0101" Then
    DoCmd.DeleteObject acTable, tdf.Name
    CurrentDb.TableDefs.Refresh
  End If
Next tdf
End Function

but I need to delete "B0101", "B0102", "B0103" etc....
can someone show me how to add the other tables into the code?
ASKER CERTIFIED SOLUTION
Avatar of peter57r
peter57r
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of JefKve
JefKve

Public Function DeleteTable()
Dim tdf As TableDef
For Each tdf In CurrentDb.TableDefs
  If (tdf.Name = "B0101" or tdf.Name = "B0102" or tdf.Name = "B0103")  Then
    DoCmd.DeleteObject acTable, tdf.Name
    CurrentDb.TableDefs.Refresh
  End If
Next tdf
End Function

but I need to delete "B0101", "B0102", "B0103" etc....
can someone show me how to add the other tables into the code?
Avatar of smidgen

ASKER

thanks peter57r
worked perfectly
Thanks

Pete