What makes a table 'clone' itself in Relationships view? (1 Viewer)

Philocthetes

Has a great deal to learn
Local time
Today, 02:14
Joined
Dec 19, 2017
Messages
28
The subject is my basic question. The context is a content production tracking database where I have a Users table that currently is related to 12 other tables, a number which could grow slightly before I'm finished designing.

In the Navigation pane, I see only one table named Users. In Relationships view, I see Users, Users_1, and Users_2. What's up with that?
 

isladogs

MVP / VIP
Local time
Today, 10:14
Joined
Jan 14, 2017
Messages
18,209
You or someone else has added it several times. Delete all duplicates.
The same effect can be achieved in queries where it can be extremely useful.

However I can think of no benefit in having duplicates in the relationships window.
 

Philocthetes

Has a great deal to learn
Local time
Today, 02:14
Joined
Dec 19, 2017
Messages
28
Hi Ridders,

I'm the only person touching the database (I'm still designing it), and I never added the Users table manually--it just appeared after I used the Lookup wizard to connect a task-user field, e.g. Who_Prepped_Batch, to the list in Users.

G.W.
 

isladogs

MVP / VIP
Local time
Today, 10:14
Joined
Jan 14, 2017
Messages
18,209
Hi Ridders,

I'm the only person touching the database (I'm still designing it), and I never added the Users table manually--it just appeared after I used the Lookup wizard to connect a task-user field, e.g. Who_Prepped_Batch, to the list in Users.

G.W.

Not quite sure what 'connect a task-user field' means.
Why not delete all duplicates, repeat that action and see if it happens again?
If it does, then provide an idiots guide to replicating this issue for others to try.

However, odd behaviour like this is often a sign of corruption.
Make a backup copy or two.
Try repairing by decompiling to remove any corrupt compile code, then recompile and finally compact
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 04:14
Joined
Feb 28, 2001
Messages
27,140
G.W.

The wizard cloned the table reference to create a 'permanent' self-referential relationship that the Lookup field thought it needed. (One reason why we don't like Lookup fields on this forum.) The reference is benign in that it is only a pointer. As long as you have the lookup field, though, you probably should not delete it. The lookup field wizard created it for a reason.

(Edit: I see that Minty and I were answering at about the same time.)

The relationship reference is benign but the lookup field in the table might not be. These lookup fields cause all types of headaches as you go forward. Within the last month we've had a couple of folks who found that building a query against a table with a lookup field was a non-updateable query even though under any other circumstances it might have been. The lookup field causes an ambiguity that prevents the query from allowing an update. It is the ambiguity that is the problem because there is now an implicit JOIN to a multi-valued table behind the table that has the lookup field. Stated another way, a lookup field carries baggage with it, and it is not always good baggage.

Ridders

The benefit of having a duplicate entry in the relationships window has to do with self-referential data elements where the central theme of the database is the relationships between/among like objects.

Example: In a genealogical database, you have a list of people. You have relationships between records such as "record 196 is the father of record 231 IN THE SAME TABLE" (and the converse "child" declaration, of course). In such a database, you will probably have lots of queries that need to exploit that self-referential type of relationship.

Example: In a project management database you have milestones, but you quickly find that there are dependencies such that Milestone X cannot even start until Milestone W has finished. Again, the interdependence of the various Milestones leads to a self-referential relationship in the relationship window. If you have a lot of queries to write that will exploit the interdependence, then you make it permanent in the master window rather than in the individual query design window. Not to mention the implied documentation value that comes when you have such a relationship staring you in the face.

3rd (and last) example: Sometimes we get people who have an inventory database for things that they make on site, and they sell both the things they make AND the raw materials that a crafts person might use to make such things themselves. They have relationships for the "assembled" items that reference the components that made them, and the junction table that itemizes components of an assembly needs two references to the same inventory table, one for the assembly and one for the components. Again, you need the double reference, though in this case it is to support the junction table rather than a direct reference in the inventory table itself.

In all cases, if the physical relationship of self-referentiality exists (despite what my spell-checker says), then by all means document it in the relationships window!
 

isladogs

MVP / VIP
Local time
Today, 10:14
Joined
Jan 14, 2017
Messages
18,209
Hi Doc

Yes I can see the point now but have always just done this in the query designer. Even in e.g a family tree db, you wouldn't always need the link in place
Just a thought. If you make the SR link permanent, could there be any unwanted side effects in some sense?
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 04:14
Joined
Feb 28, 2001
Messages
27,140
Ridders said:
could there be any unwanted side effects in some sense?

If the self-relation is a significant element of the problem and is likely to be used a lot, any possible negatives are outweighed by the positive effects associated with a relationship that can be used to enforce RI and support faster creation of JOIN queries via Wizard.

The only possible side effect of which I am aware involves confusion of someone who looks at the relationship diagram but doesn't know enough about Access or the problem to know what it means. But why is such a person looking anyway, other than morbid curiosity or mischief? I don't personally know of any negatives, but would be willing to be enlightened if any other member has come across such a negative.

Ridders said:
have always just done this in the query designer

You DO bring up one valid point: The ability exists to allow a "spot" relationship in the query design window. However, here is the converse for you: If you DON'T want to take advantage of an extant "global" relationship, you can REMOVE it for the single query. My thought is to ask this question: What are you going to do more often? Exploit the self-relationship or ignore it? If you are going to exploit it A LOT then make it global. If you are going to use it sparingly, define it only in the query designer.

Remember that Access is dumber than a box of rocks BUT the wizards DO know how to take advantage of what you tell them about data relationships. If you are building a database, the wizards ARE good to help build the basic scaffolding, leaving it to you to "dress it up a bit." Let the machine work for you when possible. Makes your part of the job that much easier.
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 05:14
Joined
Feb 19, 2002
Messages
43,223
However I can think of no benefit in having duplicates in the relationships window.
Regarding the discussion on self-referencing relationships - like any relationship, you want the database engine to enforce it rather than your code so I would ALWAYS specify RI in the relationship window. The clone of the databse simply makes the relationship visual.

As to other uses of the clone, there are situations where you might have more than one relationship from table1 to table2. For example, the record holds BillingAddress and ShippingAddress. Each of the State fields has a separate relationship with the State table. The ONLY way to manage this is by having a clone of the State table to define the second relationship.

The third use is for clarity. In a complex diagram, you might want to clone a table simply to eliminate relationship lines that cross over large parts of the diagram. This just gives a cleaner look.
 

Philocthetes

Has a great deal to learn
Local time
Today, 02:14
Joined
Dec 19, 2017
Messages
28
The wizard will have created the relationship, assuming it was a table level lookup.

Generally we avoid using them as they cause confusion - see here [see link above] for some of the reasons.

Items 2-4 and 6-7 alone or together have me sold on ditching the lookups. Avoiding bloat and being prepared for possible migration to SQL Server are especially important for this project.

The database is for a master's theses scanning project. We cannot be certain about the final number of titles we'll end up with because the books span several eras of cataloging practices, which when combined with the occasional human error, almost guarantee a few hundred or even a few thousand titles that we'll need to add along the way.

All, the ensuing discussion here has made me understand just why the UI kept nagging me to start a thread. The pros around here can take a simple ball of yarn and run it around many chair, table, and couch legs in the room. I especially appreciate the examples of when self-referentiality (added to whatever 'my dictionary' is in this UI) is useful/necessary.
 

Minty

AWF VIP
Local time
Today, 10:14
Joined
Jul 26, 2013
Messages
10,368
Glad we helped. Good to see thread with many viewpoints and thoughts.
 

Users who are viewing this thread

Top Bottom