subform inside subform

F

FlaRed

I believe I know th eanswer for this one, but... I have a form and it has a
subform. The subform has another subform inside. Does access allow that to
happen ?

Thanks..
 
B

BruceM

Yes. You can nest up to 7 levels in Access 2003. If you have another
version you can check Help for "Specifications", but 3 levels is no problem.
Only the "innermost" form (the last one in the string) can be Continuous.
 
S

Sprinks

FlaRed,

Yes and no. Access does not permit a *continuous* subform to be embedded on
another continuous subform, which is usually what you're trying to do, e.g.,
to model a one-to-many-to-many relationship like
Customers->Orders->OrderDetails.

A solution to the problem is to have two continuous subforms embedded on the
main form. The first many side, (Orders in the example) would be linked by
the main form's primary key (CustomerID). The second needs to be linked by
the primary key of the first subform, or, OrderID. Since you can't link it
directly, place a hidden textbox on the main form, and use the OnCurrent
event of the first subform (and the OrderID's AfterUpdate event if you're not
using an AutoNumber) to write the OrderID of the current record to the hidden
textbox.

' OnCurrent event code
Me.Parent![txtMyOrderID] = Me![txtOrderID]

Then you link the 2nd subform by it's OrderID and the hidden textbox. Then
as you scroll through the Orders in the 1st subform, the corresponding detail
appears in the second.

Hope that helps.
Sprinks
 
Top