SubForm Row Addition

  • Thread starter Thread starter Mary
  • Start date Start date
M

Mary

I am unable to add multiple rows in a subform, datasheet
view. I populate the fields and then receive 'Index or
primary key cannot contain a Null value.' The primary key
is in the main form not the subform and does contain
information. Thank you. Mary
 
Subforms are designed to be bound to a related table, not the same one as
the main table.

The subform's table will have its own primary key field, and will also have
a foreign key field. All the records where the foreign key matches the main
form's primary key turn up in the subform, because of the LinkMasterFields
and LinkChildFields properties of the subform control.

If the subform's table has an AutoNumber as primary key, that value will
turn up automatically. If you have a relationship between the main form's
table and the subform's table, and you have the LinkMasterFields and
LinkChildFields set up correctly, the foreign key field will also be
populated automatically (unless the main form is at a new record).

There may also be other fields in the subform's table that have a unique,
non-null index.
 
Back
Top