Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Subform within a subform

Status
Not open for further replies.

cjany

IS-IT--Management
Nov 3, 2004
72
0
0
US
I need to build a form that shows owner information, each property that they owe taxes to and then each tax year that is due for each property. My main form has the owner information. I built a subform for each property that is linked to the main form by name. Now I want to add a subform to the existing subform to show the breakdown in years for each property. When I try to add the second subform, I get a message that I cannot view a subform as a continuous form if it contains a subfom.

Does anyone have any other suggestions?
 
Hi cjany

I've successfully done this with the subforms displaying in datasheet view instead of continuous form view.

David
 
Yes, but I'm not happy with the user having to expand the record to see the data.
 
Instead of Nested subforms you can build synchronized sub forms. I think there is a FAQ on how to do it. Basically have a main form with two subforms: Property subform and next to it in continous view the Property detail subform.

Now the trick is on the main form have a field that is usually hidden. I call this field txtBxLink. On the Property Sub form On Current event set the value of txtBxLink to the ID of the specific property. Now link the other subform to txtBxLink. And yes you can link subforms by controls not just fields.
 
OK, I'll try it.

Thank you
 
How are ya cjany . . .

How to Synchronize Forms . . . Your Way!

Calvin.gif
See Ya! . . . . . .
 
cjany,
I would take a look at the AceMan's FAQ because it give a lot of flexibility to synchronize forms even if they are not subs of each other, and understanding how to use controls as query criteria is important.
However if you are simply doing subforms on main forms this all the code that you need, and it would exist on the property sub form.
Code:
Private Sub Form_Current()
  Me.Parent.txtBxlink = Me.autoPropertyID_PK
End Sub

Where "txtBxLink" is an unbounded control on the main form (Owner Form), and "autoPropertyID_PK" is what I named the Property's (Home's) primary key. Now just link your Year Breakdown subform to the "txtBxLink". The only trick is you can not do this with the wizard because it only allows you to choose fields not controls. In the Year Breakdown subform properties you have to hand type in "txtBxLink" in the "Link Master Field" under the data tab.

With this approach you can synchronize as many subforms as you want. With nested subforms you are limited to three. Also synch subforms are usually a lot easier to understand then multiple nested subforms.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top