VBA Deleting Relationships

J

Jim

Hi.
I have a database that is used by multiple sites, but I
am unsure if they all have their relationships set up
properly.

What I decided to do is make two tables that hold the
relationships as they should be defined, and I wrote code
that creates those relationships.

The thing is, I don't know how to delete the old
relationships first. I would like to clear all of the
relationships out before I run the process the re-creates
all of them.

Can anyone tell me how to do this in VBA? Thanks in
advance!

-Jim
 
D

Douglas J. Steele

Try something like:

Do While Relations.Count > 0
Relations.Delete Relations(0)
Loop
 
A

Adrian Jansen

It is possible to write VBA code to delete relationships, but I think you
are on the wrong track. Relationships can only exist within one database
file, and must be on the backend - the file containing the data tables. All
your frontends should contain only the queries, forms and reports - no
data - so no relationships. The fact that some frontends may contain copies
of the relationships established on the backend is somewhat accidental - and
leads to much confusion IMHO. Worse, if you split the front ends off at
various times during development, each frontend gets a different version of
the relationship window - maybe what you are seeing. However the *real*
relations are still only held and enforced on the backend.

--
Regards,

Adrian Jansen
J & K MicroSystems
Microcomputer solutions for industrial control
 
A

Adrian Jansen

Further to my own comments, I should have said that the relationships are
refreshed on the front end when you refresh the links to the backend.
Unfortunately the pretty relationship graphic window is totally screwed up
when you do this. But the relations themselves are intact, and held as
securely as the rest of the data in the database.

--
Regards,

Adrian Jansen
J & K MicroSystems
Microcomputer solutions for industrial control
 

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

Top