Form/Subform Connection

NeroMaj

Registered User.
Local time
Today, 08:02
Joined
Sep 13, 2010
Messages
34
I have a form that contains a subform. Both the main form and the subform have the save Data source, which is a table.

When I open the subform separately it loads all of the records perfectly, however, when I open the form with the subform in it, it only loads the first record.

Any idea as to why this might be?
 
Check which layout the subform is using? In the properties of the subform you need to look for Default View and make sure it is datasheet or Continuous Forms
 
Checked that. Ran it with both continuous and datasheet view. It still only populates the form with 1 single record, when there are 87 in the data source.
 
Check the relationships of the table so they are 1 to Many and then in the main form go into design view and then select the subform, you need to look at the Master and Child relationships are connecting to the correct fields
 
A main form and a subform SHOULD NOT HAVE THE SAME TABLE as the recordsource. This will only cause you problems.
 
I have a couple questions based on that.

when I click on the main form, it says that it depends on the subforms...isn't this backwards?

I changed the setting the subform's record source to the On Current procedure of the main form and was able to load a set of records based on a pre-existing query, but I couldn't load the entire set of records based on the table...any thoughts here?
 
I have a couple questions based on that.

when I click on the main form, it says that it depends on the subforms...isn't this backwards?

I changed the setting the subform's record source to the On Current procedure of the main form and was able to load a set of records based on a pre-existing query, but I couldn't load the entire set of records based on the table...any thoughts here?

If you upload a copy of your database (with bogus data of course) I can tell you why this is happening. You need to make sure that you have the correct side of the one-to-many relationship as the main form and the many side be the subform. One common mistake is putting the foreign key in the wrong table. So taking a look at the table structure may also help with seeing why that is happening.
 
Okay, I will work on getting a sample, but I have a few things I have figured out since then.

The dependency of the tables was off somehow, but I have that correct now. I still think the dependency of the forms is off.

One thing to note, I am really only using the main form as a container for the other forms and not really to perform any actions. This being said here is what I have been able to do so far.

I can set the subform record source equal to a query such as

Form_frmMain.RecordSource = "qryACEA". It loads fine, but when I try to add a new recrod I get an error message saying "The object doesn't contain the automatic object 'ID'

If i add the id field to the query, it doesnt load anything on the form, and if i try to do the following:

Form_frmMain.RecordSource = "tblEAD" (tblEAD is the main table that qryACEA is being pulled from) then only the first record loads.
 

Users who are viewing this thread

Back
Top Bottom