need to allow foreign key duplicates

dannydm

New member
Local time
Today, 14:04
Joined
Nov 23, 2005
Messages
7
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!
 
Check the FK column on your table and see what it's properties are, bet NO DUPLICATES is selected.
 
that is checked but the table is a linked table with sql server, how do i change that in sql server. the identity field on the properties for the column is not selectable or changeable....
 
SQL must have a non-duplicates allowed index on that column. It would have to be changed on the SQL side.
 
1. Make sure that the master/child links are properly set.
2. NEVER base a form on a non-Jet table. ALWAYS use queries that select the minimum number of records. Opening a form with a table or no-criteria query is like opening a pipeline to the database. Access keeps shuffling data from the server to the client until it is ALL local. You loose a major benefit of using non-Jet tables.
 
finally sussed it out, SQL manager has a option on the indexe's properties to create unique and that was checked, as soon as you uncheck that, and of course update your linked tables, you can add more than one record on the subform.

Thanks for all your help guys!
 

Users who are viewing this thread

Back
Top Bottom