Another subform problem ?!?

  • Thread starter Thread starter Charlotte
  • Start date Start date
C

Charlotte

OK, I got my subform linked to my main form which is a
tabbed form. I have 2 subforms under different tabs.

When I click on either of these 2 tabs, I immediately get
an Access message "you cannot add or change a record
because a related record is required in
table 'tablename'". The table it mentions is not a part of
the one-to-many relationship between the form and subform
but is a table linked to the recordsource of the main form.

I presume that when I access a subform, Access tries to
save the data on my main form and because I have not
filled in this field, this is causing the problem?

I have referential integrity set for all of my table
relationships. Is this a problem?
 
Charlotte said:
OK, I got my subform linked to my main form which is a
tabbed form. I have 2 subforms under different tabs.

When I click on either of these 2 tabs, I immediately get
an Access message "you cannot add or change a record
because a related record is required in
table 'tablename'". The table it mentions is not a part of
the one-to-many relationship between the form and subform
but is a table linked to the recordsource of the main form.

I presume that when I access a subform, Access tries to
save the data on my main form and because I have not
filled in this field, this is causing the problem?

That would do it.
I have referential integrity set for all of my table
relationships. Is this a problem?

Not if that is what your requirements are.

Just clicking to change the TabPage shouldn't be enough to trigger a save
of the main form though. I would think you would have to actually click on
the Subform itself. Do you have anything in the Change event of the
TabControl to force focus to the subform? Perhaps if the Subform is the
only thing on the new page it gets focus automatically, but I don't
remember that being the case.
 
Back
Top