If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Parent/Child form problem
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 |
#2
|
|||
|
|||
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 "Jerry" wrote in message ... 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 |
#3
|
|||
|
|||
-----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 "Jerry" wrote in message ... 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. |
#4
|
|||
|
|||
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 |
#5
|
|||
|
|||
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 -----Original Message----- 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 . |
#6
|
|||
|
|||
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; -- Ken Snell MS ACCESS MVP "Jerry" wrote in message ... 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 |
#7
|
|||
|
|||
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 wrote in message ... -----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 "Jerry" wrote in message ... 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. |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Help problem with macro and form | Lycantrius | General Discussion | 2 | August 6th, 2004 05:59 AM |
dlookup | miaplacidus | Using Forms | 9 | August 5th, 2004 09:16 PM |
Passing value to modal child form in MS Access using VBA? | Grahammer | Using Forms | 6 | July 4th, 2004 11:53 PM |
Recordset in subform based on field in parent form | Lyn | General Discussion | 15 | June 14th, 2004 03:10 PM |
Problem adding a command button to a form in order to open another form | Janice | New Users | 2 | May 10th, 2004 11:31 PM |