Parent/Child form problem

  • Thread starter Thread starter Jerry
  • Start date Start date
J

Jerry

I have a parent/child form set up that's giving me an
error. Here's the background data:

Parent Form (frmActivateTeacherForSession)
Data is based on a query, which is based in part on
tblTeacherData, which has [TeacherKey] as the PK
(autonumber)
Allow Data Entry: No
No event procedures

Child Form (frmActivateTeacherForSessionSubform)
Data based on tblTeacherSessionData, which has the field
[TeacherKey]
There is an On Open procedure that sets the default value
for one of the fields (not the TeacherKey)
Master and Sub forms are linked on the field [TeacherKey]

Relationships:
tblTeacherData and tblTeacherSessionData have a one-to-
many relationship, based on [TeacherKey]

As soon as I hit the first key to enter data in the
subform, I get this error: "The LinkMasterFields property
setting has produced this error: 'The object doesn't
contain the Automation object 'tblTeacherData.'' After
that, I can add data. But then, when I try to close the
form, I get this message: "You cannot add or change a
record because a related record is required in table
tblTeacherData.

I don't understand what the "object" or the "Automation
object" the first error is referring to. The
Parent/Child linking seems to be working.

Sorry if this is confusing. What do I need to do to fix
this?

Thanks in advance.

Jerry
 
Post the queries' SQL statements that serve as the record sources for the
main form and the subform. The error appears to be saying that the main
form's query isn't what you think it is.
 
-----Original Message-----
Post the queries' SQL statements that serve as the record sources for the
main form and the subform. The error appears to be saying that the main
form's query isn't what you think it is.

--

Ken Snell
<MS ACCESS MVP>

I have a parent/child form set up that's giving me an
error. Here's the background data:

Parent Form (frmActivateTeacherForSession)
Data is based on a query, which is based in part on
tblTeacherData, which has [TeacherKey] as the PK
(autonumber)
Allow Data Entry: No
No event procedures

Child Form (frmActivateTeacherForSessionSubform)
Data based on tblTeacherSessionData, which has the field
[TeacherKey]
There is an On Open procedure that sets the default value
for one of the fields (not the TeacherKey)
Master and Sub forms are linked on the field [TeacherKey]

Relationships:
tblTeacherData and tblTeacherSessionData have a one-to-
many relationship, based on [TeacherKey]

As soon as I hit the first key to enter data in the
subform, I get this error: "The LinkMasterFields property
setting has produced this error: 'The object doesn't
contain the Automation object 'tblTeacherData.'' After
that, I can add data. But then, when I try to close the
form, I get this message: "You cannot add or change a
record because a related record is required in table
tblTeacherData.

I don't understand what the "object" or the "Automation
object" the first error is referring to. The
Parent/Child linking seems to be working.

Sorry if this is confusing. What do I need to do to fix
this?

Thanks in advance.

Jerry

This is the Query on the Parent Form:

SELECT tblTeacherData.TeacherKey, *
FROM RegisteredTeachers RIGHT JOIN tblTeacherData ON
RegisteredTeachers.TeacherKey = tblTeacherData.TeacherKey
WHERE (((tblTeacherData.TeacherKey) Not In (select
TeacherKey from tblTeacherSessionData)));

The data source for the child form is one of my tables
(tblTeacherSessionData).

"RegisteredTeachers" in the query above is another query
that selects those teachers who are already registered
for a session from tblTeacherData (meaning they have a
record in the tblTeacherSessionData table, which has a
one-to-many relationship, based on SessionKey).

The more I try to explain this, the more confused I get!
Better quit and leave well enough alone for now.

thanks.
 
Perhaps something that could help me would be a more
direct way to do the following:

(Background: Table A (one) related to Table B (many),
linked on SessionKey)
Query needed: What teachers in Table A have no records in
Table B for Session X?

Jerry
 
Not sure if this will help with the overall problem but
you need a "Find Unmatched" query. Go into queries / new /
find unmatched and follow the prompts. At the end of this
check the box to modify your query and see what the wizard
produces.

HTH
 
This is a generic query for returning all records in TableA that have no
child records in TableB:

SELECT TableA.*
FROM TableA
LEFT JOIN TableB
ON TableA.PrimaryKeyField =
TableB.PrimaryKeyField
WHERE TableB.PrimaryKeyField Is Null;
 
Look at the LinkMasterFields property for the subform control. Does it
contain the full reference to the desired field: tblTeacherData.TeacherKey

The Automation error is saying that it cannot find a field or control named
"tblTeacherData" in the main form's RecordSource, which of course is not
there (as shown by the SQL statement that you posted).
--

Ken Snell
<MS ACCESS MVP>



-----Original Message-----
Post the queries' SQL statements that serve as the record sources for the
main form and the subform. The error appears to be saying that the main
form's query isn't what you think it is.

--

Ken Snell
<MS ACCESS MVP>

I have a parent/child form set up that's giving me an
error. Here's the background data:

Parent Form (frmActivateTeacherForSession)
Data is based on a query, which is based in part on
tblTeacherData, which has [TeacherKey] as the PK
(autonumber)
Allow Data Entry: No
No event procedures

Child Form (frmActivateTeacherForSessionSubform)
Data based on tblTeacherSessionData, which has the field
[TeacherKey]
There is an On Open procedure that sets the default value
for one of the fields (not the TeacherKey)
Master and Sub forms are linked on the field [TeacherKey]

Relationships:
tblTeacherData and tblTeacherSessionData have a one-to-
many relationship, based on [TeacherKey]

As soon as I hit the first key to enter data in the
subform, I get this error: "The LinkMasterFields property
setting has produced this error: 'The object doesn't
contain the Automation object 'tblTeacherData.'' After
that, I can add data. But then, when I try to close the
form, I get this message: "You cannot add or change a
record because a related record is required in table
tblTeacherData.

I don't understand what the "object" or the "Automation
object" the first error is referring to. The
Parent/Child linking seems to be working.

Sorry if this is confusing. What do I need to do to fix
this?

Thanks in advance.

Jerry

This is the Query on the Parent Form:

SELECT tblTeacherData.TeacherKey, *
FROM RegisteredTeachers RIGHT JOIN tblTeacherData ON
RegisteredTeachers.TeacherKey = tblTeacherData.TeacherKey
WHERE (((tblTeacherData.TeacherKey) Not In (select
TeacherKey from tblTeacherSessionData)));

The data source for the child form is one of my tables
(tblTeacherSessionData).

"RegisteredTeachers" in the query above is another query
that selects those teachers who are already registered
for a session from tblTeacherData (meaning they have a
record in the tblTeacherSessionData table, which has a
one-to-many relationship, based on SessionKey).

The more I try to explain this, the more confused I get!
Better quit and leave well enough alone for now.

thanks.
 
Back
Top