Need To Allow Foreign Key Duplicates
Nov 28, 2005
hi,
i have a form with a sub-form on it. each has is bound to a table. the main form's table has a one to many relationship with the sub-form table, and the sub-form table has the PK of the main table as a FK.
every time i try to add a second record to the sub form, it gives me an error saying i cant have duplicate foreign keys.
i cant figure out what to do. i am using access 2003 and microsoft sql server version 8. i need to enable duplicate foreign keys so that each record of the main table can have more than one record in the sub table.
Please help!
View Replies
ADVERTISEMENT
Feb 12, 2008
Hi this is my first post... so hi all :)
ok what i have is a table with contact details 900k plus
there are about 90k of which are duplicates.
this is the basic feilds that are important in this case.
Id, data_source, data_recived, data_code,
what i want is to have a table with unique records (no dups in data_code)
this table will look like this...
Id, data_code, Num_dups, dup1_source, dup1_date, daysbtw_Dup1_dup2, dup2_source, dup2_date, daysbtw_Dup2_dup3 ,dup3_source, dup3_date, daysbtw_Dup3_dup4 ,dup4_source, dup4_date,
I know there is no more than 4 dups of each record.
what i want from this is a table that will give me a record of how many dups for each record then all the dates that they were added and the date between each record entry.
if anyone can help it would be great .
thanks in advance.
View 6 Replies
View Related
Dec 8, 2005
Hey, all! Thanks for helping, here is my situation.
I have a table with about 70,000 records that have duplicate Address field values. The rest of the field values for those records are different. When I do a find duplicate querry I get the result that 17,000 records have the same address. However, when I do the append qurrey as instructed here: http://support.microsoft.com/?kbid=209183 I get a total of only 600 records in the new table. I have tried deleting all of the indexes for both the new and old table, with no luck.
I'm using Access 2000 on XP Pro.
If anyone could help with this I would greatly appreciate it!
Thanks
Will
View 14 Replies
View Related
Nov 1, 2014
I have an Access table with an indexed key that is currently set to duplicates OK. There are not supposed to be any duplicates in that field. But it is possible than a small number have crept through.
Two questions:
1. What would happen to those duplicate records if I changed the setting from duplicates OK to no duplicates?
2. Is there any way to ferret out those duplicate records first and change them manually? The table currently has 48000 records so it would be a pain to go through them page by page. (I know how to export them to Excel, where the dups can easily be found; I was just wondering if something could do it within Access.)
View 2 Replies
View Related
Apr 3, 2008
Ive got problem with defining foreign key
i explain what table ive and what i want
between my Student ,Session there is many to many relation that student session connect them together
student: Format student session: Format
Student ID Autonumber Student ID Autonumber
student name Session ID Autonumber
student address
student dob.....
....
Session: format
Session ID Autonumber
dance days
dance time
no of student
the student id is primery key and session id is primery key ,student session is compound key of this 2 but it wont work it keep saying u can only have one auto number in one table #
what should i do ?
View 8 Replies
View Related
Mar 19, 2007
Hi all,
my question is what is a foreign key and how is it used ?
View 5 Replies
View Related
Jun 8, 2007
Hey all, i'm new here! I've spent hours upon hours trying to solve this problem, but it's got me nowhere, so I think it's time to ask for help! I'm not exactly an Access beginner (I generally know what i'm doing) but this has me stumped!
Ok, basically my DB has several tables.
Staff (main table)
Qualifications
Institutions
The problem is - i'm trying to set it up so the fields "qualificationName" and "institutionName" in the staff table extract the data from the fields with the same names in the qualifications/institutions tables.
I've tried linking the fields together as foreign keys, but when I go to set referential integrity, I get the error "No unique index found for the referenced field of the primary table"
staffID in each table is linked properly, but that's as far as it will let me go!
Any help would be really appreciated!
View 4 Replies
View Related
Apr 2, 2008
hi
i am new to access 2003 ,i would like to know how do i tell access which attribute is foreign key of another primery key ,for example
if i have two table
1.student
2.order
i want to have student id as foriegn key in order how would i do that ?
thanks
View 1 Replies
View Related
Aug 25, 2006
Hi,
While designing a database, I came up with 3 different foreign keys in one table. I am afraid this is not right!
Is it possible to have this number of FK in one table or does that suggest a design flaw?
Any help will be very much appreciated.
B
View 7 Replies
View Related
Apr 12, 2008
it wuld be helpful if any of u can tell me how to link tables to query using primary key and foreign key or web page where i can solve my problem.
View 1 Replies
View Related
Oct 23, 2004
I have a table with Client info, I then have child tables with info on what workshops the client has attended or if the client recieved services. The idea is to use "ClientName" as the primary key in the main "Client Info" Table and then use this same field as the Foreign key in the smaller child tables. Everything seems to work out except if I want to "Enfore Referential Integrity" in the relationship. When I try to do that I get this error message:
Relationships must be on the same number of fields with the same data types
Is this going to screw me up later?
Thanks
mark
View 2 Replies
View Related
Apr 28, 2007
i am creating a database and i had created two tables one is holidays and second is departure date.. in the holidays table the primary key is holiday code.
and in the departure date table the primary key is Departure Key and there is also field is Holiday Code. now i had create two tables and then i had insert both the table in one but the problem is this when i am changing the primary key's data of holidays table but the rest field is not changing.. i think its need to assign foreign key but i don't know how to do that can u plz tell me how to insert the foreign key.
i doing my assignment and i am stuck here plz reply me soon so that i can move further..
View 3 Replies
View Related
Aug 28, 2006
I have three tables as below, linked by a many-to-many relationship.
Contact Table
ContactID (PK-Autonumber)
Contact details...
Mailing Table
MailID (PK-Autonumber)
ContactID (FK)
NewsletterID (FK)
Details...
ynMailed
Newsletter Table
NewsletterID
Details...
My Problem: I have acquired 200 customers in one month, and I have to MANUALLY assign each bulk mailing recipient. This will not do. I've experimented with Queries to do the work for me, but keep tripping over a foreign key violation.
My Question: How can I create many records in the Mailing table with a constant Newsletter ID and whichever contacts my Select query returns? How do I populate the SECOND foreign key (the constant Newsletter ID) so I don't get the key violation?
I thought about doing a Make Table Query based on my Select Query, then an Update query to create the second foreign key, then an Append query with all the values in place. Is there an easier way?
I feel like this should be really easy, but two weeks of tinkering have gotten me nowhere. A nudge in the right direction would be greatly appreciated.
View 2 Replies
View Related
Jun 6, 2005
Hi All, Me Again :eek:
I have another issue that has stumped me:
On the mainform [frm1930Census] I have a couple of subforms [sbf1930CenHeader & sbf1930CenDep]
The primary key [FTMID] has passed from the mainform to the 1st subform [sbf1930CenHeader] correctly. Using the one to many relationship attached by the [FTMID] field.
The problem is the primary key [1930CenHdrID] from the subform[sbf1930CenHeader] should then travel to [sbf1930CenDep] which it does not. The relationship between the two subforms are one to many focusing on the [1930CenHdrID] field/
I am using the following code:
Private Sub Ctl1930CenHdrID_BeforeUpdate(Cancel As Integer)
Me.1930CenHdrID = Forms![frm1930Census]![sbf1930CenHeader].[Form]![1930CenHdrID]
End Sub
Any help will be most appreciated.
~VanEpps
View 1 Replies
View Related
Apr 16, 2006
Hi, I'm trying to create a basic database to track customers and to log conversatons/activity with the company.
I've two tables. One to hold the company info (e.g. comp_id, comp_name, comp_address, etc. etc.) and another to hold the conversations/history (e.g. hist_id, hist_date, hist_detail and comp_id which is the foreign key).
The problem I'm having (and it's probably basic) is that I've created two forms. One to display the companies and one to show the history of a particular company. I've added a button on the companies form which opens the history form (based on the selected record) where the two comp_id's match however, if I try to add a new conversation/history the comp_id foreign key isn't updated with the current comp_id and therefore isn't shown the next time I view the history of that company.
The tables are joined on the comp_ids as a one to many relationship.
Apologies if I haven't explained very well. Still finding my way with access.
View 5 Replies
View Related
Apr 20, 2006
I'm not new to access, and I understand normalization at pretty much all its levels, but right now I'm curious about a situation that I have just come across. The first time I've been in something like this, so I thought I would ask.
This is the setup.
I have employees. They are apart of a shift and a budget. Shifts and budgets are completely independent of each other.
The database needs to keep track of shifts and budgets over time. Therefore, 1 to many relationship to shift table and budget table.
But, the database also needs to keep track of attendance. And the user wants attendance tracked by Shift and Budget.
Shift and budget are completely independent of each other.
Currently, I have the relationships set up like this.
Employee (1) ---(Many) Budget (1)------(Many) Attendance
Employee (1) ---(Many) Shift (1)--------(Many) Attendance
When a new attendance record needs to be added, both the key to the budget and shift are added to the attendance table. The key chosen is dependant onthe Employee chosen, and whether the budget and shift are the CURRENT budget and shift that the employee is apart of.
I thought of running a query showing budget and shift by date descending, so that the latest budget / shift would be displayed, and thus the most current (SUPPOSEDLY) But, if a user put in a different date, or screwed up on the date, then the incorrect shift and/or budget would be displayed.
Date stamping an entry was an option, but there needed to also be a user entered date as well, to specify WHEN a user began working in that specific budget / shift. Therefore two date entries would be required. Duplicate entries in most cases.
I therefore decided to go with a true/false yes/no checkbox. Where the current budget or shift would be checked, and all non current ones would be unchecked (false).
Currently, this is how the systems works. And it works well. But it is dependent on some form code I created to set the yes/no checkbox to true/false depending on the situation.
I DON"T like doing this. Am I missing a way to do this "correctly" where by Access would do this "automagically" instead of via my trick.
The ONLY issue really, is that when a new attendance incident occurs, the user needs to put in the incident to the approbriate shift / budget. And if the current shift / budget could automatically be displayed without user intervention (IE user has to pick the shift / budget from drop down box after looking up info etc etc) since the current information SHOULD be known.
I've never done a table setup where two foreign keys are the many side of the relationship in a single table.
It is currently working fine, and seems to do well, but I wanted to make sure with others who might have had this experience. And also, any "advice" / "cautions" for this kind of situation so I don't step into it deep and have to fix it later.
View 14 Replies
View Related
Dec 15, 2004
I have done multiple searches with no luck- sorry to ask such a basic question, but I want to know the correct way of inserting a foreign key into a table.....I was told to Insert - Lookup field - in my main table - is that correct?
Thank you :confused:
View 14 Replies
View Related
Jul 8, 2005
More on the lot materials management program.
I have a series of related table:
Builder
Subdivision
Lot Number
Lot Option
Lot Materials Details
The [Lot Materials Details] table is populated by appending data from the [House Type Details] table tree as follows:
Builder
House Type
Elevation
Options Per Elevation
House Type Materials Details
The filtered Option Table in both branches determine which [House Type Materials Details] records get appended to the [Lot Materials Details] table.
The question is:
Is there any advantage, other than simpler queries later on, to adding the primary key from the [House Type Materials Details] table to the [Lot Materials Details] table.
It’s redundant because the [Lot Options Table] contains the [Options Per Elevation] primary key.
Any thoughts?
View 2 Replies
View Related
Sep 25, 2006
hi
i need to create a table, i've figured out to make LastName the primary key. But im not so sure about the foreign key, and whether it is necessary to put it into the table in order for all my tables to relate? Sorry if this doesn't make much sense.
Also, to clarify.. 3NF primary keys in one table cannot be used in another table??
thanks
View 2 Replies
View Related
Oct 19, 2007
Hello,
I'm using Allen Brownes very helpful cascade-to-null relations (http://allenbrowne.com/ser-64.html) code in my database project, but there comes problems whit a foreign key and null values, cause foreign key shouldn't be null. Is there anyone else using this method with relational tables? What I should do to make this work?
All hints and tips are welcome and approciated, thanks on advantage. =)
- IpeXeuS
View 14 Replies
View Related
Aug 5, 2007
Wow, I've found some good stuff here already... Thanks.
PROBLEM:
I have a table(we'll call it shipping) that has two columns FK'ed to another table (locations). My problem is I have no idea how to pull the information from the locations table into the shipping table.
DESCRIPTION:
My shipping table has a source and a destination column. Now, I have a fixed location list that applies to both columns and I'd like to avoid having a source tbl and a destination tbl... I'm an Access Neophyte to say the least (for now at least) but I have managed to put together a querie that pulls out most of the information that I need (name, phone number, yadda, yadda, yadda) but I can't seem to correctly link the FK's for the sources to the locations table as well as the FK's for the destinations to the locations table. When I run my querie I get an error or my Source(destination) column will display the correct information but the Destination(source) column will display ALL of the locations in the location table. Here's what I mean:
Source destination
detroit toledo
detroit cleveland
detroit San Diego
detroit London
detroit Paris
detroit detroit
Paris toledo
Paris cleveland
Paris San Diego
Paris London
Paris Paris
Paris detroit
.
.
.
The first and second source was detroit and Paris but the Destinations list all of the locations I have in the table.
How can I link two FK's in one table to another table in a querie?
Thanks.
View 5 Replies
View Related
Dec 22, 2004
When I view data in linked tables in MS Access containing foreign characters (umlauts, accents, etc), the foreign characters are not being displayed properly. It is not a font or Access setting because I am using a separate similar database (also containing linked tables) where the foreign characters are being properly displayed.
Is there a setting I'm missing in the linking of the tables? Not sure where else to check.
View 1 Replies
View Related
Apr 4, 2013
I have two tables in my Db: tblMaster & tblAddresses. They are joined with a one-to-many relationship, with the addresses being the "one" side. Many entries in tblMaster have the same address.
I use a form, based on a query, to add records which creates the new vendor in tblMaster, and (if I have contact details), a record in tblAddresses. The problem is that while the PK is created in tblAddresses once I add the address info, the related FK field in tblMaster is not populated with that #.
View 5 Replies
View Related
Jun 19, 2013
I basically have an Issue's table and a Customer Table relationship set-up.
I want to information to be viewed in the Customer table however I can only see 1 Issue where as a Customer may have 2 or 3 Issues.
I have come up with inserting the whole table into the form however I don't like this look.
View 5 Replies
View Related
Oct 5, 2015
Can a table have two foreign keys?
View 1 Replies
View Related
Sep 27, 2015
I have a database - which was originally made up of two tables that were not linked.
So I split one table into two and then populated a linking table to link to the other table. Up till I wanted to integrate the second table it all worked with test searches etc working perfectly.
Ok in my linking table I have a field fk_MemorialId which should link to the memorial table field MemorialID which is a primary key.
However the fields in the table are Mlink,Inscription,Links,PLot and GraveNo and None are unique.
ie Mlink can refereed to several graves , links is an empty field, GraveNo and PLot refer to a location that can have severed bodies is it. Innscription again is not unique and illogical as it sounds the inscriptions in the table tblmemorial bear little similarity to the inscription filed in the other tables I suspect the original developer gave up on linking.
How to populate this linking field.
I do realise that in the relationship chart below fields are duplicated and will delete them but I was hoping to use the fields as criteria for an update.
View 2 Replies
View Related