Link Subforms

  • Thread starter Thread starter chopper57 via AccessMonster.com
  • Start date Start date
C

chopper57 via AccessMonster.com

I have a MainForm with three datasheet forms on it.
First form "SovItems" is auto linked to the MainForm
Second form "SovInstalled" is linked by a unbound box using txtLink, like I
found in the disucssin groups and it's working good.

The third one is where I have a problem.
I want to link my third form to the second form, but I'm using a composite
key.
My composite key is "ItemNo" and "PayAppNo"
I can link the form using only the "PayAppNo" but when I try to enter data
I received the message "Cannot add or change because a related record is
required in tbl_SovInstalled.

Is this because it's linke with only one of the composite keys?
Is there a way to write the control source so it links both keys?

This is what I have now in the txtLink : frm_SovInstalled.Form!PayAppNo
How would I add the other key "ItemNo" if it's possible?
 
I don't really understand what you mean with «Second form "SovInstalled" is
linked by a unbound box using txtLink »; so I cannot really help you here on
this particular problem.

However, I can tell you that ADP has many problems with composite key. The
best way to solve your problem might be to use an independant identity field
as the primary key. If you set up the UniqueTable and the ResyncCommand
properties, you shouldn't have any problem for editing existing record. For
adding record, all you will have to do would be probably to use the
OnBeforeInsert event to fill up the two fields "ItemNo" and "PayAppNo" with
their correct values.

You could also try to keep your current schema design and use the
OnBeforeInsert event to fill up the value for ItemNo; however, I don't know
if this will correct the problem with the error "Cannot add or change
because a related record is required in tbl_SovInstalled.". In fact, I
cannot even tell you if the field ItemNo is the missing field in the table
tbl_SovInstalled.
 
Back
Top