Which Subform to display dependent upon a datavalue

iandanescourt

New member
Local time
Today, 11:26
Joined
Apr 29, 2004
Messages
8
I have a form with several subforms layered with the use of the tab control icon in the form toolbox and I am wishing one of the categories to display either formA, formB or formC dependent in a value in the main form.

Is this possible or do I have to have all 3 subforms in the same position and just have the form visable properties dependent upon the data value.

I have searched through the previous threads and have been unable to locate a soution, appologies to all if it is staring me in the face
 
The best way is to use a single subform control sized to fit your largest subform. Then as you decide which subform you want to display, change the ControlSource of the subform control. You may need to repaint or refresh the main form to get the new subform to show.
 
Yeah you can do that.


in the AfterUpdate function for the control say:

If x = 1 then

Forms!Main Form!FormA.Form.Visible = True
Forms!Main Form!FormB.Form.Visible = False
Forms!Main Form!FormC.Form.Visible = False

ElseIf x = 2 Then

Forms!Main Form!FormA.Form.Visible = False
Forms!Main Form!FormB.Form.Visible = True
Forms!Main Form!FormC.Form.Visible = False

ElseIf x = 3 Then

Forms!Main Form!FormA.Form.Visible = False
Forms!Main Form!FormB.Form.Visible = False
Forms!Main Form!FormC.Form.Visible = True

End If

NOTE:

Check out the syntax on the .Visible statement. you need the ".Form" in there
 

Users who are viewing this thread

Back
Top Bottom