D
Denise Pollock
Hello,
I am trying to automate the database update process. I created a macro to
delete all the tables in the database. However since there are linked tables
it stops part way through. From browsing other questions I found the code
below to delete all my relationships. I have no inkling whatsever on how to
use VBA. I opened a module and pasted this code in there. But when I try to
use the runcode in my macro this string is not available. How do I get this
into a macro?
Sub KillAllRelations()
Dim db As DAO.Database
Dim rel As Relation
Dim inti As Integer
Set db = DBEngine(0)(0)
For inti = db.Relations.Count - 1 To 0 Step -1
Set rel = db.Relations(inti)
Debug.Print "Deleting relation "; rel.Name, rel.Table,
rel.ForeignTable
db.Relations.Delete rel.Name
Next inti
End Sub
Thanks in advance,
I am trying to automate the database update process. I created a macro to
delete all the tables in the database. However since there are linked tables
it stops part way through. From browsing other questions I found the code
below to delete all my relationships. I have no inkling whatsever on how to
use VBA. I opened a module and pasted this code in there. But when I try to
use the runcode in my macro this string is not available. How do I get this
into a macro?
Sub KillAllRelations()
Dim db As DAO.Database
Dim rel As Relation
Dim inti As Integer
Set db = DBEngine(0)(0)
For inti = db.Relations.Count - 1 To 0 Step -1
Set rel = db.Relations(inti)
Debug.Print "Deleting relation "; rel.Name, rel.Table,
rel.ForeignTable
db.Relations.Delete rel.Name
Next inti
End Sub
Thanks in advance,