Is it possible to create more than one relationship model?

D

Danus31

Hi,

I need to test out some theories and would like to know (without copying the
db & etc) if there is a way to create more than one relationship model? Save
them as tests or theories without destroying the underlying current
relationship model.

Thank you
 
A

Albert D. Kallal

Danus31 said:
Hi,

I need to test out some theories and would like to know (without copying
the
db & etc) if there is a way to create more than one relationship model?
Save
them as tests or theories without destroying the underlying current
relationship model.

Thank you

No, not really. If you doing testing and playing around, just work on a
copy. One of the really great features of access is that all tables, indexes
etc. are in ONE file. So, you can just make a copy, play, mess with..and
then toss it out, and you still have your original copy....
 
K

Keven Denen

Hi,

I need to test out some theories and would like to know (without copying the
db & etc) if there is a way to create more than one relationship model?  Save
them as tests or theories without destroying the underlying current
relationship model.

Thank you

As far as I'm aware, Access doesn't support multiple, simultaneous
relationship models.

The easy solution would be the one you've mentioned, copy the
database. Why are you against working with multiple files for testing
purposes?

The more complex answer would be to create VBA code that creates/
deletes your relationships at the push of a button, but in a database
of any complexity, you'll spend more time creating the code than you
would probably spend manually creating/deleting the relationships
especially if you only want to change it once. If you want to flip
back and forth between the options many times, this may save you some
time.

If you'd like to go this route, here's some code to get you started.

This will create a relationship between table1 and table2 using
table1.ID1 and table2.ID2 as the linking fields.

Dim db As DAO.Database
Dim rel As DAO.Relation
Dim fld As DAO.Field

Set db = CurrentDb

'Create the relationship
Set rel = db.CreateRelation("foo", "table1", "table2")
'Referential integrity with cascade update - several different
options here
rel.Attributes = dbRelationUpdateCascade
'Key field in table1
Set fld = rel.CreateField("ID1")
'Key field in table2
fld.ForeignName = "ID2"
'Add field to relation
rel.Fields.Append fld
'Add relation to database
db.Relations.Append rel

And this to delete all the relationships.

Dim db As Database
Dim rex As Relations
Dim rel As Relation

Set db = CurrentDb()
Set rex = db.Relations
Do While rex.Count > 0
rex.Delete rex(0).Name
Loop
 
D

Dorian

Not possible.
-- Dorian
"Give someone a fish and they eat for a day; teach someone to fish and they
eat for a lifetime".
 
J

John Spencer

It depends on what you mean.

Take a look at Stephen Lebans' site.
www.lebans.com

Specifically,
http://www.lebans.com/saverelationshipview.htm

A2KSave-Restore-ModifyRelationshipWindow.zip
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

John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
 
K

Keven Denen

It depends on what you mean.

Take a look at Stephen Lebans' site.
   www.lebans.com

Specifically,
   http://www.lebans.com/saverelationshipview.htm

A2KSave-Restore-ModifyRelationshipWindow.zip
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 froma 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

John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County






- Show quoted text -

While Stephen's tool is very neat, I don't think it will accomplish
what the OP is asking. All Stephen's tool does is save the layout of
the relationships window (the on-screen location of the tables/links).
It doesn't allow you to change the way that tables are related to each
other.

Maybe a more pointed question to the OP is why are you wanting to do
this. I can't think of any set-ups where there are multiple valid ways
to relate your data together without changing the structure of your
data. What are you trying to accomplish by having multiple
relationship models?

Keven
 

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