Nesting multiple subforms in a continuous-view main form

  • Thread starter Thread starter Pete
  • Start date Start date
P

Pete

Hello -

Access doesn't permit me to show a form in continuous view
with two nested subforms in it. However, I was told that
there's a trick around this - if anyone knows what it is
and how to do it, I'd greatly appreciate the help. Thanks
a lot.
 
Pete said:
Hello -

Access doesn't permit me to show a form in continuous view
with two nested subforms in it. However, I was told that
there's a trick around this - if anyone knows what it is
and how to do it, I'd greatly appreciate the help. Thanks
a lot.


Although I've never tried it, I think the 'trick' to which you refer is
to place a subform in the footer section of the continuous Form. Or am
I talking complete rubbish?!

Hugh
 
Sandra hi-

Firstly, thanks for your quick reply.

However, though I understand what you're saying to do, I'm
wondering how that ties in w/my problem exactly.

My problem is that my "main form" here is actually a
subform itself (I've been talking about what I refer to as
form "C" below). I have four form levels in this type of
arrangement:

-A: Main Form
-B: Subform
-C: Sub-Subform
-D1: Sub-Sub-Subform 1
-D2: Sub-Sub-Subform 2

Both A and B are single forms, and that's fine (each has
its own combo-box with a list of records to make searching
easy for the user). B updates w/A as it should, and that's
fine & dandy.

First, I wanted C in datasheet form, though I couldn't
since I have two subforms under it (if you know a way to
show both simultaneously while C is in datasheet view, I'd
e interested to hear that). Then I chose to go the route
of having C as a continuous form, until I realized that
continuous forms don't support subforms at all (not even
1). My original question in this thread was a work around
to that, since someone else on here said he'd heard of
one. Anyway, I finally set C as another single form, with
D1 and D2 as nested subforms of C. Because C is a single
form, I added a combo box (that acts as the "list" to
search records in C), which I have a query update
OnCurrent in the PROPERTIES of C. I have identical list
setups in both A and B, so I figured C would be no
different.

The problem that finally poked its head up after testing
the database is this... as I scroll through records in A,
and all of the subsequent subforms update, everything's
fine. When I scroll through records in B, C will update
fine, HOWEVER, I get an error about C's combo box, saying
it could not update.

This is what I think your original reply may offer a
solution to, though I'm not sure yet... if I replace the
combo box in C with a synchronized subform, will it update
on its own without a hitch?

I'm sorry I turned this reply into a full explanation of
the database, though I figure it'd be best I explain the
whole thing to you so that you can maybe make an alternate
suggestion if you see a better alternative. Thanks so much
for the help - and if anyone else out there has something,
feel free to share it - any help is appreciated.

Take care.

-----Original Message-----
Hi Pete,

I typically use either a pair of synchronized subforms (list on left with
detail on right) or a listbox and subform which are linked.

To synchronize subforms you would use a hidden textbox on the mainform
(frmA). This textbox on the main form has it's ControlSource set to refer
to the control you want to use to link the two subforms. Name this textbox
txtOrderId (or something more meaningful).

Controlsource =sfrmB.Form.Orderid
visible=false

Note that 'sfrmB' above refers to the first subform (the list) and must be
the name of the subform control on the mainform - this is not necessarily
the same name as the name of the form object that you see in the database
window. To be sure, select the subform control, then look at the Name
property under the Other tab. This is the name that should be used in all
references to the subform.

To synchronize, set the LinkMasterfield property of sfrmC (the detail
subform) to txtOrderid (skip out of the linking wizard because this control
will not be offered in the list - however you are not limited to the field
list that the wizard offers, you can type in the name of any control on the
main form. Set the linkchildfield property of the subform to Orderid.

Here's a link to my sample database that offers several different
alternatives for displaying this type of data including the technique
described above:

http://www.daiglenet.com/msaccess.htm
--
Sandra Daigle
[Microsoft Access MVP]
For the benefit of others please post all replies to this newsgroup.

Hello -

Access doesn't permit me to show a form in continuous view
with two nested subforms in it. However, I was told that
there's a trick around this - if anyone knows what it is
and how to do it, I'd greatly appreciate the help. Thanks
a lot.

.
 
Hi Pete,

Your current set up should work - provided that the combo on C is unbound
(so it can be used as a recordselector) and that the RowSource for the combo
is limited by the value of the linking field in B. What error were you
getting? In the Current event of B you probably need to requery C but I
think it should work.

The pair of synchronized subforms should also work: So your model would look
like this:

-A: Main Form
-B: Subform
-C1: Sub-Subform(continuous)
-C2: Detail
-D1: Sub-Sub-Subform 1
-D2: Sub-Sub-Subform 2

Your hidden control would be on B and would refer to the key value in C1.
Then use the hidden control as the linking field for C2.


--
Sandra Daigle
[Microsoft Access MVP]
For the benefit of others please post all replies to this newsgroup.
Sandra hi-

Firstly, thanks for your quick reply.

However, though I understand what you're saying to do, I'm
wondering how that ties in w/my problem exactly.

My problem is that my "main form" here is actually a
subform itself (I've been talking about what I refer to as
form "C" below). I have four form levels in this type of
arrangement:

-A: Main Form
-B: Subform
-C: Sub-Subform
-D1: Sub-Sub-Subform 1
-D2: Sub-Sub-Subform 2

Both A and B are single forms, and that's fine (each has
its own combo-box with a list of records to make searching
easy for the user). B updates w/A as it should, and that's
fine & dandy.

First, I wanted C in datasheet form, though I couldn't
since I have two subforms under it (if you know a way to
show both simultaneously while C is in datasheet view, I'd
e interested to hear that). Then I chose to go the route
of having C as a continuous form, until I realized that
continuous forms don't support subforms at all (not even
1). My original question in this thread was a work around
to that, since someone else on here said he'd heard of
one. Anyway, I finally set C as another single form, with
D1 and D2 as nested subforms of C. Because C is a single
form, I added a combo box (that acts as the "list" to
search records in C), which I have a query update
OnCurrent in the PROPERTIES of C. I have identical list
setups in both A and B, so I figured C would be no
different.

The problem that finally poked its head up after testing
the database is this... as I scroll through records in A,
and all of the subsequent subforms update, everything's
fine. When I scroll through records in B, C will update
fine, HOWEVER, I get an error about C's combo box, saying
it could not update.

This is what I think your original reply may offer a
solution to, though I'm not sure yet... if I replace the
combo box in C with a synchronized subform, will it update
on its own without a hitch?

I'm sorry I turned this reply into a full explanation of
the database, though I figure it'd be best I explain the
whole thing to you so that you can maybe make an alternate
suggestion if you see a better alternative. Thanks so much
for the help - and if anyone else out there has something,
feel free to share it - any help is appreciated.

Take care.

-----Original Message-----
Hi Pete,

I typically use either a pair of synchronized subforms (list on left with
detail on right) or a listbox and subform which are linked.

To synchronize subforms you would use a hidden textbox on the mainform
(frmA). This textbox on the main form has it's ControlSource set to refer
to the control you want to use to link the two subforms. Name this
textbox txtOrderId (or something more meaningful).

Controlsource =sfrmB.Form.Orderid
visible=false

Note that 'sfrmB' above refers to the first subform (the list) and must
be the name of the subform control on the mainform - this is not
necessarily the same name as the name of the form object that you see in
the database window. To be sure, select the subform control, then look
at the Name property under the Other tab. This is the name that should be used in all
references to the subform.

To synchronize, set the LinkMasterfield property of sfrmC (the detail
subform) to txtOrderid (skip out of the linking wizard because this
control will not be offered in the list - however you are not limited to
the field list that the wizard offers, you can type in the name of any
control on the main form. Set the linkchildfield property of the subform
to Orderid.

Here's a link to my sample database that offers several different
alternatives for displaying this type of data including the technique
described above:

http://www.daiglenet.com/msaccess.htm
--
Sandra Daigle
[Microsoft Access MVP]
For the benefit of others please post all replies to this newsgroup.

Hello -

Access doesn't permit me to show a form in continuous view
with two nested subforms in it. However, I was told that
there's a trick around this - if anyone knows what it is
and how to do it, I'd greatly appreciate the help. Thanks
a lot.

.
 
Back
Top