won't allow new records in a subform

  • Thread starter Slez via AccessMonster.com
  • Start date
S

Slez via AccessMonster.com

I have a mainform with a subform with another subform (I'll refer to this as
subform2). When trying to add a new record to subform2, I get the error:
"Index or primary key cannot contain a Null value"

I have created this format numerous times before and believe I have all my
Link Child Fields and Link Master Fields references correct. The primary
keys in this case are [ProjectID] and [ProjectName], and you can clearly see
when I make those fields visible that they do not automatically fill with the
primary key values that are selected in either the subform or the mainform.

My previously created forms do this properly, and I appear to have all the
property settings in accordance with that. (Obviously with appropriate field
names referenced.)

My bottom line question is: When adding a new record, how do I get the
fields to take on the value of the related fields in the subform or mainform?

Any help is appreciated!
Slez
 
K

kingston via AccessMonster.com

Do you have a main form with two subforms or a nested subform (main form:
subform:subsubform)? In any case, the tables should update automatically
from the top down if linked correctly. IOW, the main form must have the key
data first for the subform to automatically create a properly linked record.
If this isn't working and you've checked the Link Master/Child Fields
property, do you have another key field that needs to be populated? Try
removing the subform and then recreating the link by adding it back. Also,
the key fields may not automatically populate until data is entered or saved.

If you include the key fields in the subform and populate them manually, you
might be able to create orphaned records. However, you'll have to add code
to make this work properly (i.e. create a corresponding parent record).
I have a mainform with a subform with another subform (I'll refer to this as
subform2). When trying to add a new record to subform2, I get the error:
"Index or primary key cannot contain a Null value"

I have created this format numerous times before and believe I have all my
Link Child Fields and Link Master Fields references correct. The primary
keys in this case are [ProjectID] and [ProjectName], and you can clearly see
when I make those fields visible that they do not automatically fill with the
primary key values that are selected in either the subform or the mainform.

My previously created forms do this properly, and I appear to have all the
property settings in accordance with that. (Obviously with appropriate field
names referenced.)

My bottom line question is: When adding a new record, how do I get the
fields to take on the value of the related fields in the subform or mainform?

Any help is appreciated!
Slez
 

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