By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,647 Members | 1,331 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,647 IT Pros & Developers. It's quick & easy.

Forms and Subforms: Master ID Key not carrying to linked Child ID Key

P: 15
Hello again.

I have setup a master form linked to a subform (actually nested subforms, but the top level subform is the one giving me trouble.) When entering data, the forms all appear to work correctly, but the moment that you change the record in the parent/master form, the forms "lose" all of the data we enter from the subforms. Upon examination of the tables, I found that the master key is not being populated into the top level subform, so I suspect that the records are simply "disappearing" because it doesn't know to associate the previous records entered with that Master record.

Thanks.
Elaina
Jan 3 '07 #1
Share this Question
Share on Google+
11 Replies


P: 15
Hello again.

I have setup a master form linked to a subform (actually nested subforms, but the top level subform is the one giving me trouble.) When entering data, the forms all appear to work correctly, but the moment that you change the record in the parent/master form, the forms "lose" all of the data we enter from the subforms. Upon examination of the tables, I found that the master key is not being populated into the top level subform, so I suspect that the records are simply "disappearing" because it doesn't know to associate the previous records entered with that Master record.

Thanks.
Elaina
Perhaps I should ask a question?
How do I make the child subform pull the Parent ID for the current/selected record?

Thanks.
Elaina
Jan 3 '07 #2

MMcCarthy
Expert Mod 10K+
P: 14,534
Hello again.

I have setup a master form linked to a subform (actually nested subforms, but the top level subform is the one giving me trouble.) When entering data, the forms all appear to work correctly, but the moment that you change the record in the parent/master form, the forms "lose" all of the data we enter from the subforms. Upon examination of the tables, I found that the master key is not being populated into the top level subform, so I suspect that the records are simply "disappearing" because it doesn't know to associate the previous records entered with that Master record.

Thanks.
Elaina
Elaina

This sound more like a relationship problem. Do the records in the table behind the subform have a fully cascading relationship with the records in the table behind the main form. In other words is the foreign key in the subforms table being entered automatically when a new record is being added.

Mary
Jan 4 '07 #3

P: 15
Elaina

This sound more like a relationship problem. Do the records in the table behind the subform have a fully cascading relationship with the records in the table behind the main form. In other words is the foreign key in the subforms table being entered automatically when a new record is being added.

Mary

I'm relieved that you asked that. I did check and it wasn't set correctly initially. I fixed that and it's still not working. Is there something that I need to do to refresh the forms to "apply" the change?

Thanks.
Jan 4 '07 #4

MMcCarthy
Expert Mod 10K+
P: 14,534
I'm relieved that you asked that. I did check and it wasn't set correctly initially. I fixed that and it's still not working. Is there something that I need to do to refresh the forms to "apply" the change?

Thanks.
It depends on what changes you made. Check out the master/child properties on the subform object. Are they set to the field you think they should be.

Mary
Jan 4 '07 #5

P: 15
It depends on what changes you made. Check out the master/child properties on the subform object. Are they set to the field you think they should be.

Mary
So here's the setup:

Master table: Movie
Child table: Occurrences
master/ child link are both m_id ( unique key in Movie and 1 to many relationship and cascading references are selected)

Here's what I'm trying to do:

A data entry person opens the form and selects a record they wish to work on based on a "coder" field. They only have access to change the data in one field. All the others should choose which movie they are working on.

The occurrences subform should allow the data entry person to add records to the Occurrences table and related them by m_id.

After additional troubleshooting:

Seems like my master table may be trying to create a brand new record instead of selecting an existing record. I put in a Requery statement Onchange for one of the fields on the Mater form and it gives an error (unique key cannot be null). Sounds like a new record... What have I done.

Thanks.
Elaina
Jan 4 '07 #6

MMcCarthy
Expert Mod 10K+
P: 14,534
So here's the setup:

Master table: Movie
Child table: Occurrences
master/ child link are both m_id ( unique key in Movie and 1 to many relationship and cascading references are selected)

Here's what I'm trying to do:

A data entry person opens the form and selects a record they wish to work on based on a "coder" field. They only have access to change the data in one field. All the others should choose which movie they are working on.

The occurrences subform should allow the data entry person to add records to the Occurrences table and related them by m_id.

After additional troubleshooting:

Seems like my master table may be trying to create a brand new record instead of selecting an existing record. I put in a Requery statement Onchange for one of the fields on the Mater form and it gives an error (unique key cannot be null). Sounds like a new record... What have I done.

Thanks.
Elaina
If you have a movie record that currently has no occurances what shows in the occurances subform?

Has Occurances got it's own primary key and is this an autonumber?

Is m_id showing on the subform?
Jan 4 '07 #7

P: 15
If you have a movie record that currently has no occurances what shows in the occurances subform?

Has Occurances got it's own primary key and is this an autonumber?

Is m_id showing on the subform?
Nothing shows in the Occurrences subform. The occurrences subform does have it's own primary key and it is an autonumber. The m_id is not showing on the subform. I didn't originally put it in because the coders down need to know what it is. I added it for troubleshooting purposes.

But I think that the master form is creating a new record in the movie table instead of selecting the record associated with the movie that the data entry people are working on.

Thank you.
Elaina
Jan 5 '07 #8

MMcCarthy
Expert Mod 10K+
P: 14,534
Nothing shows in the Occurrences subform. The occurrences subform does have it's own primary key and it is an autonumber. The m_id is not showing on the subform. I didn't originally put it in because the coders down need to know what it is. I added it for troubleshooting purposes.

But I think that the master form is creating a new record in the movie table instead of selecting the record associated with the movie that the data entry people are working on.

Thank you.
Elaina
How is the master form being opened?

Sorry Elaina but I'm getting more not less confused about what is going on.

Mary
Jan 5 '07 #9

P: 15
How is the master form being opened?

Sorry Elaina but I'm getting more not less confused about what is going on.

Mary
The main/master form is just opened from the main access window. Double click on the form title and it just opens with the occurrences subform. Tell me if this helps:

Table name: Movie

Fields: Function On form:
Movie name bounded combo box
m_id (unique key) not required for data entry people to see
review type not editable
review status editable

So, when the DE people select a new movie name from the bounded combo box, instead of selecting that record with all of the associated data from the movie table, it's trying to create a new record with the movie name that the DE person selected. Before I made the m_id a unique key, it was actually creating the new record with a blank m_id, now it's giving me an error that the unique key can not be null.

Sorry for the confusion. Hope this helps you help me. :)

Elaina
Jan 5 '07 #10

MMcCarthy
Expert Mod 10K+
P: 14,534
The main/master form is just opened from the main access window. Double click on the form title and it just opens with the occurrences subform. Tell me if this helps:

Table name: Movie

Fields: Function On form:
Movie name bounded combo box
m_id (unique key) not required for data entry people to see
But it has to be on the subform and the main form or their is no relationship for the subform to the mainform. The controls can be invisible but they must be on the forms.

Mary
Jan 5 '07 #11

P: 15
The main/master form is just opened from the main access window. Double click on the form title and it just opens with the occurrences subform. Tell me if this helps:

Table name: Movie

Fields: Function On form:
Movie name bounded combo box
m_id (unique key) not required for data entry people to see
review type not editable
review status editable

So, when the DE people select a new movie name from the bounded combo box, instead of selecting that record with all of the associated data from the movie table, it's trying to create a new record with the movie name that the DE person selected. Before I made the m_id a unique key, it was actually creating the new record with a blank m_id, now it's giving me an error that the unique key can not be null.

Sorry for the confusion. Hope this helps you help me. :)

Elaina

Shoot- formatting didn't carry over...

Table name: Movie

Fields / Function On form:
Movie name / bounded combo box
m_id (unique key) / not required for data entry people to see
review type / not editable
review status / editable
Jan 5 '07 #12

Post your reply

Sign in to post your reply or Sign up for a free account.