Link to home
Start Free TrialLog in
Avatar of flevy
flevy

asked on

Automatically changing subforms

Hi.  I've overloaded a tab page with way too many pages, each of which contains a few calculated subforms which, overall, is overwhelming my application.

As opposed to cutting up the tabs into several, smaller tab pages, I wanted to see if I could just automatically change subforms via a script -- that is, simulate how a web page works with frames (i.e., you have a master "form", and depending on what buttons you press, it will open deferent "subforms" in a designated subform area).

Was wondering if I could click on a button, and have it change the data source of the subform (e.g., subforma, subformb, subformc)?  This would save me a lot of recoding time, and presumably reduce the burden on the application by keeping closed subforms that I'm not using anyway.

Many thanks!

Farron
Avatar of SiJP
SiJP

Yep there is....

... in its simplest terms...

Private Function fChangeSubForm

 Dim mySubfrm as String
 mySubfrm = fsubSomeFormName

 subfrmobject.SourceObject = mySubFrm

End Function

ASKER CERTIFIED SOLUTION
Avatar of SiJP
SiJP

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of flevy

ASKER

Works great -- thanks.  One follow-on question...

When I change the subforms, how do I then grab values from that subform?  Whenever a new subform comes up, I wanted to grab a specific calculation from that subform.  However, I'm having difficulty doing that.  Logically, I'd like code to perform the following function:

For Form/subformA combination:
Form.sfAdatacapture = Form.subformA.finalcalc

Then, when Form/subformB displays, capture similar data:
Form.sfAdatacapture = Form.subformB.finalcalc

Problem is, once a new subform is in place, it doesn't seem to recognize the traditional Form.subform.control path.  Does the original Form.subform persist as some kind of mask, such that I need to code the controls on various subforms the sames way?

Thanks!
Avatar of flevy

ASKER

Just tested the 'mask' theory another way, and it works.

Thanks for the initial solution.