Form and SubForm Errors

G

Guest

I have developed an application with 1 main form with 8 subforms across the
bottom of the main form. All forms are linked to the main form with 1 key
field called Case No.

When doing data entry into the main form and then tabbing onto one of the
subforms and entering data, when done and attempting to save the information
I get the following error message:

The changes you requested to the table were not successful because they
would create duplicate values in the index, primary key, or relationship.
Change the data in the field or fields that contain duplicate data, remove
the index, or redefine the index to permit duplicate entries and try again.

The only item that is duplicated between all of the forms is the Case No
field. This is a key to the main form and all subforms (that's the way there
linked together).

Any suggestions for solving this would be greatly appreciated!
Thanks in advance!
 
J

Jon Furman

This might be because the record that the mainform represents has not yet
been created so that when Access attempts to add the subform data there is
no parent record that has been stored yet(even though you ahve all the
parent data represented in the form). I ran into something along these lines
once and what I did was to force the form to save the parent record before
additions to the subforms were allowed. Hope that helps.

Jon Furman
 
D

Dirk Goldgar

rdhaz1 said:
I have developed an application with 1 main form with 8 subforms
across the bottom of the main form. All forms are linked to the main
form with 1 key field called Case No.

When doing data entry into the main form and then tabbing onto one
of the subforms and entering data, when done and attempting to save
the information I get the following error message:

The changes you requested to the table were not successful because
they would create duplicate values in the index, primary key, or
relationship. Change the data in the field or fields that contain
duplicate data, remove the index, or redefine the index to permit
duplicate entries and try again.

The only item that is duplicated between all of the forms is the Case
No field. This is a key to the main form and all subforms (that's the
way there linked together).

Any suggestions for solving this would be greatly appreciated!
Thanks in advance!

If you're getting the message as you leave the subform, that suggests
that you may not have the indexes set up properly in the subform's
recordsource table, or else that you aren't supplying a value for one of
the fields that make up the that table's primary key. On the other
hand, if this is happening when you run some code to save data, maybe
your code is trying to save a record that has already been saved. It's
hard to say without more information.

Please post the recordsources of the main form and the subform, and
indicate what is the primary key of the subform's recordsource. Also
post the Link Master and Child Fields properties of the subform.
 

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