I have a table (tblMedia) with fields, "AssignedTo" and "ReturnedBy" which both relate to the StaffID field in tblStaff. Access won't allow creating two joins from tblMedia for both fields to tblStaff on StaffID. What I've done for now is create a tblStaffReturnedBy, which is a clone of tblStaff. However, this is not normalized, since the same data is stored in two different tables. Could anyone advise me on how to normalize this?
The relationship is the same, but because it is two separate relationships between the two tables, Access has to differentiate between the two. The relationship works the same. I'm currently working on a database that has items getting handed out. Both the "Giver" and "Receiver" fields are linked to the Employee table. The relationship layout shows tblEmployee and tblEmployee_1, but the relationship remains the same for each table. It is hard to explain, but it works.
8 12838
If you create the one relationship and then create the second relationship, it should end up adding another table to your layout with the same table name with a _1 appended to the end. You can't create them at the same time, but you should be able to create them separately.
Seth, thanks for the response. I did try creating the relationship for the two fields to the StaffID field and the AssignTo field from tblMedia was related to tblStaff while the ReturnedBy field was related to tblStaff_1. I'm just not sure what this means in terms of the actual relationship. Is ReturnedBy related to tblStaff_1.StaffID or tblStaff.StaffID? What I want is to have both AssignedTo and ReturnedBy joined to tblStaff.StaffID. Thanks in advance for any advice.
The relationship is the same, but because it is two separate relationships between the two tables, Access has to differentiate between the two. The relationship works the same. I'm currently working on a database that has items getting handed out. Both the "Giver" and "Receiver" fields are linked to the Employee table. The relationship layout shows tblEmployee and tblEmployee_1, but the relationship remains the same for each table. It is hard to explain, but it works.
I was able to create the database relationship as you mentioned, Seth. Now how do I deal with this in queries? Do I need to create a tblStaff_1 in the queries to link the ReturnedBy field to? There is no tblStaff_1 in the database. Thanks for any advice on this.
You would just add tblStaff twice, drag the link across and then make sure you choose the your fields from the correct one. Going back to my example, if I had tblEmployee related to "Giver" and tblEmployee_1 related to "Receiver", I would have to get fields from tblEmployee if I wanted information related to the "Giver" and from tblEmployee_1 if I wanted information related to the "Receiver". It acts like two separate tables, but it is really only one.
I see what you mean, Seth. It is really just using an alias for the table name and joining the 2nd field to the field in the alias table. It sure seems like a convoluted way of handling it but I can understand why Access doesn't allow 2 fields from one table to join one field in another table. Do other RDBMS programs act the same way with this situation?
An alias is a really good name for it. It may seem convoluted at first, but you get used to it. Thankfully, it doesn't happen all that often.
I have only briefly played with MySQL and SQL Server, so my knowledge of other RDBMS programs is limited, but I haven't found a "relationships" page in MySQL. SQL Server uses the same method, but this is no surprise as Microsoft did both SQL Server and Access. Personally, I can't think of a better way to do it, and as I said before, you get used to it and it works pretty well.
zmbd 5,501
Expert Mod 4TB
I think you two finally got there:
IN the relationship window you may see
tblStaff
and
tblStaff_1
For Access these are the same table - You're not going to be using [tblStaff_1] in your SQLs.
In fact, go back to the navigation panel, look at your table list... you will not see "tblStaff_1" unless you added it by hand. Create a query, in the add tables dialog, once again you will not see the "tblStaff_1" unless you added it by hand.
All Access is doing in the relationships window is an "Accounting" trick to help the user, and software, keep track of the relationships between the same two tables:
(thus)
1) [tblStaff]![StaffID] :1:M: [tblMedia]![AssignedTo]
2) [tblStaff_1]![StaffID] :1:M: [tblMedia]![ReturnedBy]
and yes, Access added an Alias
and yes,all RDMS do basically the same thing - they may just show it differently.
Personally, it would be visually cleaner to have two lines with a common starting point; however, I can understand how that could get messy if the relationships were different in the integrity settings.
In any case... BikeToWork... you can get rid of that extra table and re-normalize your database :)
Sign in to post your reply or Sign up for a free account.
Similar topics
by: LaurenW |
last post by:
Hi folks,
I just discovered that I have a table with a bunch of text fields that
ALL have the "Allow Zero Length" property set to "No", which is
apparently the default when you create a new text...
|
by: Todd D. Levy |
last post by:
I am moving 3 fields & associated data from 1 table to another.
I will have to make the necessary changes to forms, code, queries, &
reports, etc.
It is the reports, and the queries that they...
|
by: sparks |
last post by:
1 need to copy the data in one table into another...but its from another database.
tables are demographics and testdata
database1 database2
demographics
personid personid same...
|
by: Onion |
last post by:
This has to be simple, but I'm forced to admit that I'm a novice who can't
figure it out.
I have a listbox in a form that allows multiple selections. That works fine.
The problem: I can't...
|
by: MLH |
last post by:
I have an A97 table with a Yes/No field named
TowJob and a form bound to that table. The
TowJob control on the form is bound to the same
field. It is an option group with Yes and No bttns
valued...
|
by: Lyn |
last post by:
I am trying to copy selected fields from one table to another, by reading
the source table record into a recordset (ADO) and then copying the relevant
fields to an SQL statement "INSERT INTO...". ...
|
by: MLH |
last post by:
In design view, say you habitually type descriptions for each of
the table fields you create. After many moons, many many tables
and many many many fields - you wanna delete each and every
table...
|
by: MLH |
last post by:
Generally, I do not monkey with renaming controls on forms
whose name, by default, matches the name of their related
table fields. But I noticed the following today
If IsNull(Me!VColor) Then...
|
by: imnewtoaccess |
last post by:
Hi,
I am getting errors while inserting records in one table from another.
These are the structures of two tables :
file51tm_new
RecordType Text
|
by: VooDoo |
last post by:
Hi,
i am trying to copy a completed field set from one table to another.
I am using this SQL command:
INSERT INTO doc_valid SELECT * from doc_temp where id=$id
it works, but it also copy the...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |