using code to delete relationships

  • Thread starter Thread starter planetcomics
  • Start date Start date
P

planetcomics

Guest
what is the code that will allow you to search through the objects in your database, find a certain key or relationship, then delete it?
 
That's how I used to do it in DAO, but I want to write everything using ADO in Access 2000. Below is the code that searches for a table and then deletes it along with it's relationships. I want to be able to search just for a relationship and delete it.


Dim cat As ADOX.Catalog
Dim tbl As ADOX.Table
Dim key As ADOX.key
Set cat = New ADOX.Catalog

cat.ActiveConnection = CurrentProject.Connection
[FrmCustomers Subform].SourceObject = "FrmDummy"
For Each tbl In cat.Tables
If tbl.Name = "TblPullList" Then
cat.Tables("TblReserve").keys.Delete "PullsReserve"
cat.Tables("TblWantList").keys.Delete "PullswantList"
cat.Tables("TblSpecialOrders").keys.Delete "PullsSpecialOrders"
cat.Tables.Delete "TblPullList"
End If
Next tbl
 

Users who are viewing this thread

Back
Top Bottom