cannot add or change a record

gilberto

Registered User.
Local time
Today, 22:14
Joined
Apr 4, 2002
Messages
29
Hi all

I have a form 'Paper' with a combobox 'Submitting author' and also a subform 'Author'. When a new record is created, the user should select the names of the authors in the subform, and then select the submitting author in the combo box (a query selects the authors of the paper in the combo box).

The problem is that, when I try to enter the name of the authors in the subform, the following error appears: "you cannot add or change a record because a related record is required in table 'Person New' ".

If I type something in the combo box, then it allows to add the name of the authors.

Help is really welcome.
I'm quite a naive user of Access, so please be gentle.
Thanks in advance
 
Gilberto,

You don't talk about the underlying queries or tables for your form, so I'm making some wild guesses.

The error message you report sounds like you're trying to create a record in the recordsource table or query of the subform but there is no relationship yet established between the record from the subform and that of the main form. Perhaps a look at the online help regarding parent-child relationships between main form and subforms would help.

Is your Author table structured so each record has (at least) the ID of a Paper and the ID of a Person (as author)? If so, try placing a text box on the subform with its control source the Paper's ID, set its visible property to false (it can overlay other fields if need be - because it's invisible nobody will know it's there), and set its value to the main form's Paper ID at the BeforeUpdate event of the subform. You may have to define another invisible text box on the main form tied to the Paper's ID field, and save the main form's record when the focus moves to the subform for this to work.

Lots of jargon here - hope it helps.

Jim
 
Dear Jim
Thank you very much for your help - I'll check the directions you gave me and try to discover what is going wrong.
Do you mind if I'll contact you again about that?
Best wishes.
Gilberto
 
Gilberto,

No, please feel free to email me direct if you wish.

It occurred to me that when I used the term ID, or index, I did not specify that this was the primary index for the Paper and Person tables, and that it should be an autonumber-type field. In the Author table, each row has a Long Integer field that contains the ID field for the Paper, and a Long Integer field with the ID field for the Person.

Perhaps this was obvious, but I wanted to clarify since you described yourself as a "novice user".

Jim
 

Users who are viewing this thread

Back
Top Bottom