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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Multiple Sub Forms How To? 2

Status
Not open for further replies.

Cleis

Technical User
Jun 4, 2000
197
US
Hello!

Is it possible . . . .or better yet. I want to have a main form with a navigation area on the left side of the form. I would like to place an area within the main form to display sub forms. As a user selects a form in the navigation area I would like to close the "default" sub form and open the new sub form; all while the main sub forms remains displayed. I really dont want to add all of the subforms and set them to visible = False.

Any ideas would be appreciated.
 
Really,I didn't understand the question.But, you can place multiple subforms on a main form.
 
If I understand correctly, you want to change the data in the subform on the click of a button on the mainform?

If the subforms all contain the same fields, you can change the recordsource of the one subform:

Me![yoursubform].Recordsource = "yourquery"
Me.Refresh

HTH Nigel
Didn't someone say work is supposed to be fun? They didn't have computers then I guess....
 
Don't assign Source object to a subform in designtime
In form open event assign Default form as source object
whenever user clicks a command button or selects a value you need to change subform Source object to newForm in run time.

Hope this helps
 
What I'm trying to do via code is change the sub form on a Main Form from say Accounts Payable to Accounts Receivable. What I don't want to do is use the sub form wizard, rather I would like to change the sub forms via code. I'm trying to avoid loading all of the sub forms when the Main form loads.

Any Advice would be appriciated.


Rich
 
This is very easy to do and is much better than using the Tab control. I use this method all the time.

You need to place a subform on the main form using the wizard. This should be the default subform you want displayed when the main form is opened. Size the subform control how you want an give it a name like "SubFormHolder".
If you do not want a default subform displayed when the main form opens, just creat a dummy subform with nothing on it an use that.

Now lets assume you are using a set of option group buttons down the left side of the form as your menu. In the option group AfterUpdate event place code something like this:

*****************************************************
Private Sub OptionGroup AfterUpdate()
Select Case OptionGroup
Case 1
Me.SubFormHolder.SourceObject = "SubForm1"
Case 2
Me.SubFormHolder.SourceObject = "SubForm2"

And so on...

End Select
End Sub
******************************************************

For best results you should make all your subforms the same size.

Hope this helps.

Dermot
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top