Really confused about subforms !

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have 2 tables with a one to many relationship.
I have a form based on the table which is the one side of the relationship.
I used the subform wizard to set up a subform on this form for the many side
of thre relationship.
However, what I have got is unusable since it just gives me a data entry
form and it has no parent/child links built in.
Yes, I have defined the relationships between the 2 tables.
I need a continuous form that allows me to view, update, add or delete the
many side records. I assumed the wizard would do this.
I'm lost, what did I do wrong and how can I fix it?
 
Open the main form in design view and check the Link Master/Child properties
of the subform control. These should display your primary/foreign key
fields.
 
you can manually set the parent/child link properties in the main form. open
the main form in design view. click on the subform (within the main form
design view) once, to select it. open the Properties box. in the
LinkMasterFields property, enter the name of the primary key field in the
parent table. in the LinkChildFields property, enter the name of the
corresponding foreign key field in the child table.

i don't use the subform wizard, but i'm guessing that if the wizard didn't
set up the links automatically, then there may be a problem with your
defined table relationships. but try it first manually and see if it works.

hth
 
Mscertified,

Well, that's the trouble with wizards.

The first thing to check is to go to the design view of the main form,
and have a look at the Properties of the subform. What is in the Link
Master Fields and Link Child Fields properties? It should show the name
of the field from each table which is the basis of the relationship
between them.
 
I have 2 tables with a one to many relationship.
I have a form based on the table which is the one side of the relationship.
I used the subform wizard to set up a subform on this form for the many side
of thre relationship.
However, what I have got is unusable since it just gives me a data entry
form and it has no parent/child links built in.
Yes, I have defined the relationships between the 2 tables.
I need a continuous form that allows me to view, update, add or delete the
many side records. I assumed the wizard would do this.
I'm lost, what did I do wrong and how can I fix it?

Open the Form in design view. Select the Subform control (by clicking
the edge of the subform - you should see four little "handles" to
indicate that the Subform Control is selected, not the form within
that control).

View its Properties.

Fill in (by typing or selecting from a list) the appropriate linking
fields in the Master Link Field and Child Link Field properties.

If they are filled in and the form's not working, please post the
values of these two properties, and the SQL view of each form's
Recordsource.


John W. Vinson[MVP]
 
mscertified said:
I have 2 tables with a one to many relationship.
I have a form based on the table which is the one side of the relationship.
I used the subform wizard to set up a subform on this form for the many side
of thre relationship.
However, what I have got is unusable since it just gives me a data entry
form and it has no parent/child links built in.

I'm not sure exactly what you're seeing -- I think you're saying that
you can see a subForm, but that no data appear. If so, that might occur
if (for example) the "many" table is currently empty, or if none of the
links match.
Yes, I have defined the relationships between the 2 tables.
I need a continuous form that allows me to view, update, add or delete the
many side records. I assumed the wizard would do this.
I'm lost, what did I do wrong and how can I fix it?

Something that you might try (won't help with your Form, but it might
help you see if anything is wrong with the underlying Tables) is to add
a subdatasheet to your "one" Table. Open the "one" Table in Design
View, choose View-->Properties, on the Table Properties window set the
Subdatasheet Name field to the name of your "many" Table, and specify
the Link Child Field (in your "many" Table) and Link Master Field (in
your "one" Table). Having done all that, go to Datasheet View and use
the subdatasheets to determine if the correct records in the "many"
Table are being displayed. If not, you need to do some table redesign
before you repair your Form.

If the Tables are working together propery, recheck the properties of
the Subform control in your Form, especially those dealing with the
linking fields.

-- Vincent Johns <[email protected]>
Please feel free to quote anything I say here.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top