Sub Forms

k209310

Registered User.
Local time
Today, 22:12
Joined
Aug 14, 2002
Messages
184
Is it possible to get to get a sub form to load on toa form depending upon a selection from a combo.

Ie list the sub forms in a combo select the form needed an have it displayed on the main form
 
Yes, though it requires you to be a bit careful.

Build your subforms individually. In form design mode, make the form REALLY long. Insert each subform separately. Then, when you have it working right, you will move the subforms so that their upper left corners overlap. After that, you can shrink the form to its minimum size that will hold everything.

Put info in your combo box that identifies the data you wish to see. Make the combo box UNBOUND with respect to any table. Now add event code to the box's AfterUpdate event that loops through all of the possible sub-forms. How you define this is up to you. But inside this loop, if the information in the combo box does not match the info associated subform then make that form invisible. (subform.visible = False). For the one you wanted to see, make it visible.

Now, how you go about associating the combo-box options with the subforms is your call.

Personally, I would do this another way. Build a tab-control form with one tab-page for each subform plus perhaps a blank page just for aesthetics. Put a single subform, always visible, on each page of the tab control. Then just let the user select the tab. Or if you MUST use the drop-down, have the AfterUpdate event select the tab for you.
 
Thanks for that. It seems alot more fiddly than i thought it would be.

Thanks for all the advice tho. Ill give it a go and see what happens.
Cheers

Chris
 

Users who are viewing this thread

Back
Top Bottom