Primary key has multiple fields - Access 2007

A

Abay

Hello .. I have a primary key in a master file that consists of three fields
all defined sequentially in the file. I also have a form consisting of the
master file fields and the related detail file.

The definition of the multiple fields happened after some of the file master
and detail had data in it. However, all the data has the key fields filled
in.

Now after I defined the multi field key, I get the message when I try to add
a record to the detail file through my form or in datasheet view.

"You cannot change or add a record because a related record is required in
clmaster" .. clmaster being the master file.



The related record is present in the master file .. the relationship window
shows the three fields of the primary key connected between the master and
the detail.



What am I doing wrong ...



Any help would be much appreciated?



Abay
 
J

John W. Vinson

Hello .. I have a primary key in a master file that consists of three fields
all defined sequentially in the file. I also have a form consisting of the
master file fields and the related detail file.

The definition of the multiple fields happened after some of the file master
and detail had data in it. However, all the data has the key fields filled
in.

Now after I defined the multi field key, I get the message when I try to add
a record to the detail file through my form or in datasheet view.

"You cannot change or add a record because a related record is required in
clmaster" .. clmaster being the master file.



The related record is present in the master file .. the relationship window
shows the three fields of the primary key connected between the master and
the detail.

Are you using a Form and Subform to enter the detail records? If so, the
Master Link Field and Child Link Field should be the names of all three
fields, in the same order, separated by semicolons: is that the case?

If not, how are the foreign key field values being assigned? The Relationship
will *prevent* an incorrect assignment, but it will not automagically *cause*
the values to be assigned.
 
Ó

ó×ÅÔÌÁÎÁ å×ÇÅÎØÅ×ÎÁ

Abay said:
Hello .. I have a primary key in a master file that consists of three
fields all defined sequentially in the file. I also have a form consisting
of the master file fields and the related detail file.

The definition of the multiple fields happened after some of the file
master and detail had data in it. However, all the data has the key
fields filled in.

Now after I defined the multi field key, I get the message when I try to
add a record to the detail file through my form or in datasheet view.

"You cannot change or add a record because a related record is required in
clmaster" .. clmaster being the master file.



The related record is present in the master file .. the relationship
window shows the three fields of the primary key connected between the
master and the detail.



What am I doing wrong ...



Any help would be much appreciated?



Abay
 
A

Abay

Many thanks for your response, John. I had not updated the Master and Child
info which I have now done and it works.

I really appreciate your help.

Abay
 
D

david

The related record is present in the master file .. the relationship
window
shows the three fields of the primary key connected between the master the
detail.

By the way, note the order of those three fields. The system doesn't work
unless both indexes have the fields in the same order.

(david)
 

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