[AccessD] Finding & Deleting A Table Using ADO

Gustav Brock Gustav at cactus.dk
Fri Apr 21 05:00:34 CDT 2006


Hi Paul

Why not just delete the table:

Function DeleteTable()
  
  Dim cat As New ADOX.Catalog
  Dim tbl As ADOX.Table
  
  cat.ActiveConnection = CurrentProject.Connection
  On Error Resume Next
  Set tbl = cat.Tables("schednew")
  If Err.Number = 0 Then
    cat.Tables.Delete tbl.Name
  End If
  
  Set tbl = Nothing
  Set cat = Nothing

End Function


>>> paul.hartland at fsmail.net 21-04-2006 11:26 >>>
To All,
I am without success trying to write some code using ADO (Access XP) in a function which will loop through all the tables I have and if a particular table (schednew) exists then delete it.
Can anyone please provide some sample code or point me in the right direction to do this, as I am suffering from a Friday brain dead moment I think.
Thanks for any help in advance.
Paul Hartland




More information about the AccessD mailing list