Option of Two Sub Forms

DavePem

New member
Local time
Today, 12:25
Joined
Jun 20, 2005
Messages
6
Hello...
I am a newie to the forum... but like the system.

I was wondering if anyone can provide either some tips or sample of how to set up a form that give you the option of linking it to one of two forms.

Say the Main Form = General Plant Description
Sub Form One is for Info on Tractors
Sub Form Two is for Info on Trucks.

On the main form you select an option to show one of the subforms.

I have spent about 1.5 hrs trying to search the forum and so far havent found specific advice on this issue.

Thanks in advance.

Dave P
 
Last edited:
You should be able to control the visibility of your two subforms.
You can lay your subforms one on top of each other and control
each visibility such that if you want to show subform1, you would
turn its visibility on and turn off the visibility of subform2.

The reverse would be true if you want to see subform2.
 
Edtab, I have attached a database that does what you are looking for. Notice that I have used a sub form with no source, this becomes a holding point for any subform I need to load. Using the buttons I load the form I need in to the sub form by adding the name of the form to the sub form's SourceObject. This allows me not to have a bunch of subforms loaded and hidding them when not needed and displaying them when needed. This is much cleaner. The queries that are used for each form have been set with a criteria to show only the record in the textbox of the Master Form. If you move the record navigation, you will see that the record on the linked form displays, when you click on the button the details for the record displayed on the main form will display on the subform. The code below is what is behind each button.

Private Sub cmdFrm1_Click()
Me.frmSub.SourceObject = "frmOne"
End Sub

Private Sub cmdFrm2_Click()
Me.frmSub.SourceObject = "frmTwo"
End Sub
 

Attachments

Hey Godofhell, that's a neat trick. I never thought to have a choice of subforms loading in an unbound subform. *dawn breaks over Marblehead* (Massachusetts joke)

Let me ask you a performance question - would this method be faster than having tabbed subforms? I find that my forms with, say, 5 or more tabbed subforms load really slowly. Thoughts?
 
Monkeytunes, this method is faster since it only loads the form when you call it, therefore it does not eat up all the resources to maintain all the other forms on screen.
 

Users who are viewing this thread

Back
Top Bottom