Deleting relationship

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am using the following code to delete the relationships from a db:

For Each relationship In dbSlave.Relations
dbSlave.Relations.Delete relationship.Name
Next

The problem is that all relationships are deleted, but one. There is
nothing special about the relationship, because if I run the code again on
the relationship remaining, it is deleted. Anyone have any ideas?

Thanks!
 
The problem is that the Relationship Collection is re-indexed as soon as you
delete a Relationship and therefore the For ... Next loop will missed every
2nd relationship.

You need to count the number of relationship and delete from the
highest-indexed relationship first to the lowest-indexed relationship last.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top