Use code to delete and restore relationships

R

Robert_L_Ross

Long story, but the 'front end' of our databases seem to run slowly when
first installed until we refresh the tables.

I have an automated process to refresh the tables, but the problem is that I
first have to delete the relationships, then after the refresh, re-set the
relationships.

How do I do that in code? I know there is an acCmdCreateRelationship, but I
don't know how to use it.

Any ideas?
 
D

David Lloyd

You can create relations through code using the CreateRelation method of the
DAO Database object as well as the DAO Relation object. The Database object
also has a Relations collection.

The following KB article, while it may not be exactly relevant to your
situation, shows how to use these objects and the CreateRelation method.

http://support.microsoft.com/default.aspx?scid=kb;en-us;210302

--
David Lloyd
MCSD .NET
http://LemingtonConsulting.com

This response is supplied "as is" without any representations or warranties.


Long story, but the 'front end' of our databases seem to run slowly when
first installed until we refresh the tables.

I have an automated process to refresh the tables, but the problem is that I
first have to delete the relationships, then after the refresh, re-set the
relationships.

How do I do that in code? I know there is an acCmdCreateRelationship, but I
don't know how to use it.

Any ideas?
 
S

Stephen Lebans

A quck search on GoogleGroups found:

Newsgroups: microsoft.public.access.tablesdbdesign
From: "Tom" <[email protected]> - Find messages by this author
Date: Thu, 20 Feb 2003 22:02:57 +0800
Local: Thurs, Feb 20 2003 11:02 am
Subject: Re: copy relationships between mdbs (sysrel90)
Reply to Author | Forward | Print | Individual Message | Show original |
Report Abuse

I really don't know anything about sysrel90, but I think you can do that
by
code, the articles below can help;


ACC2000: How to Use DAO in Visual Basic Code to Import Relationships
http://support.microsoft.com/default.aspx?scid=KB;EN-US;210302


ACC2002: How to use ADOX to Import Relationships
http://support.microsoft.com/default.aspx?scid=KB;EN-US;304322






Perhaps this might be useful for you if you need to save/restore the
RelationShip window itself as well.
http://www.lebans.com/saverelationshipview.htm
A2KSave-Restore-ModifyRelationshipWindow.zip is an MDB containing
functions to:

1) To allow the saving of the layout of the Relationship window to a
table.
2) To allow the restoration of the layout of the Relationship Window
from a table.
3) To allow the saving/restoration of multiple Relationship Window
views.
4) To allow the importing of the layout of the Relationship Window from
an external MDB.

Here is the A97 version:A97Save-Restore-ModifyRelationshipWindow.zip


--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
 
B

Brian

When using Access for my back end also, I always create the relationships in
the back end. Then I just have to refresh the links, and the relationships
come along with them.
 

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