Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Unable to Edit Form and Subform

Status
Not open for further replies.

cschmid

Technical User
Apr 1, 2002
8
0
0
US
Posted this awhile back and it is still happening:
I have a form and subform that will not allow edits and I receive and error that it will create duplicate values in the PK when I try and edit any information. This happens right before I tab into the subform and have made changes to fields on the main form. I have the properties set to yes for Data entry, Allow Deletions, Allow edits and RecordSet type set to Dynaset.
The main form is giving the error when I attempt to save the record even before I get into the subform. I have two tables (1 for the main form and 1 for the subform) and the subform is connected via the Primary key of the main form. Is their a certain code I need to use in order to edit the data? I have ttried allow edits but it still does not work.
 
The primary key from your main table should be defined to be unique. The same key should be included as a forward key in every associated record of your table associated with your subform. The forward key cannot ever, by its nature, be unique. You may have from one to thousands of sub records all pointing to one record on your major table.

When you are establishing a main form sub form relationship, make sure you define the subform as residing in a child container on the master form. On the form, make sure your master form is related by the primary key to the foreign key of your subform.

That should resolve your problem.
Robert Berman
Data Base consultant
Vulcan Software Services
thornmastr@yahoo.com
 
Thank you for your reply. My PK is unique. I am wondering if there is some type of code that should be in the On Current Property. When I input my PK (which is called Catalog Number) it does not display the contents on my form or subform. When I tab down to the subform I am getting an error that states the record cannot be changed since the subform has related records. How the heck do I display the record and then update the records contents on my form and subform? My child / master relationships are set up correctly in that the PK on my main form (Catalog Number) is the linked to the Foriegn Key on my Subform which is called Catalog No. It is a One to Many relationship. Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top