Subform in a subform

joee

Registered User.
Local time
Today, 04:35
Joined
Apr 1, 2008
Messages
11
Hi.
I have a one to many relation between a main form and a subform. Now I want to make a subform on the subform also in a one to many relation between the 2 subforms. I want to have both subforms shown in datasheet view.
I cannot make this work.

Appreciate any assistance.
Thanks in advance.
 
I think that you will find that you can not display a sub form within a sub form that is in Data sheet view.
 
Create your main form with the sub form on it in datasheet view in the normal manner.

On the main form put a text box that references the sub forms unique id field in the data source so that when you select a record in the sub form, this ID appears in the text box.

for example

=frm_case_multi.Form!case_ref

where frm_case_multi is your sub form and case_ref is the unique ID

For the sake of this example lets call this text box "superlink"

Now create your sub sub table. This too should have a unique ID and a field that links to your sub form. Lets call this field subsub_link . Create a form for this table and place on your main form without using the wizard.

In the properties of this second sub form make the child field this linking field "subsub_link" and the master field "superlink"

I think this might give you what you want
 
Thanks a lot Stuart for your assistance.
Unfortunately I cannot make it work.
I have attached a simplified version of my DB.
I want as follows:
1 to M between Projects & Quotes
1 to M between Quotes & Deliveries
1 to M between Quotes & Suppliers

I want all the M subforms shown in Datasheet view
Appreciate if you are someone else can make these corrections in the attached database and afterwards upload it
In ad vance thanks a lot.

Create your main form with the sub form on it in datasheet view in the normal manner.

On the main form put a text box that references the sub forms unique id field in the data source so that when you select a record in the sub form, this ID appears in the text box.

for example

=frm_case_multi.Form!case_ref

where frm_case_multi is your sub form and case_ref is the unique ID

For the sake of this example lets call this text box "superlink"

Now create your sub sub table. This too should have a unique ID and a field that links to your sub form. Lets call this field subsub_link . Create a form for this table and place on your main form without using the wizard.

In the properties of this second sub form make the child field this linking field "subsub_link" and the master field "superlink"

I think this might give you what you want
 

Attachments

If you want all three forms to be in datasheet view on one (main) form then you must use subforms for each of your forms. Stuart has explained how to link a subform control to another subform control. Maybe I should explain it differently.

To link subform B to subform A via a field called ID, you:

Drop a textbox on the main form and call it txtLinkAandB. Set the control source to the ID field in subform A. Use the Expression Builder for this.

In the Link Master Fields property for subform B, type txtLinkAandB. Don't click on the elipsis (...) button. You will not find txtLinkAandB in the selection so you can only type it in.

For the Link Child Fields property for subform B, type ID (if ID is the name of the field that you want to be linked to subform A via txtLinkAandB).
 
if you want a subform inside a datasheet form or subform - you can't
if you want two subform to be on ths ame form and be linked do what Stuart Green and vbaInet said
 
if you want a subform inside a datasheet form or subform - you can't
if you want two subform to be on ths ame form and be linked do what Stuart Green and vbaInet said

However you could put a CONTINUOUS subform on the main form and format it to LOOK LIKE a datasheet and then you can stick the other subform in it's footer as a datasheet.
 

Users who are viewing this thread

Back
Top Bottom