Subform Control

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • veteranwebdesign

    Subform Control

    Hello,

    I have a main form. I want forms to open in a subform control box.
    What is the code for the option group to open the subforms in the
    control box.

    I didn't create subforms, I created regular forms, but will create
    subforms if that is needed for this to work.

    My main goal is when a user clicks on a menu item and comes to a main
    form, they can click on different buttons to open the needed form
    without me having to create the same main form over and over again to
    make it look good.

    Below is what I was provided but I'm getting an error saying the
    subform doesn't exist or is closed.

    Create an option group with the number of options the same as the
    number of
    subforms. Here's the code for three subforms, you can expand it to
    what ever
    you need:
    Me!MyTabCtl.Val ue = Me!MyOptionGrou p - 1
    Select Case Me!MyOptionGrou p
    Case 1
    Me!Subform1MyFi eld.SetFocus
    Case 2
    Me!Subform2MyFi eld.SetFocus
    Case 3
    Me!Subform3MyFi eld.SetFocus
    End Select



    Put your menu on the left and add a subform control on the right. Use
    the
    menu to set the recordsource of the subform control
    (Me!nameOfSubfo rmControl.Form. Recordsource = "SFrmMySubformN ame1").
    You can
    tinker with the properties of the subform control so that the subform
    control is transparent and all you see is the current subform.




    Put your menu on the left and add a subform control on the right. Use
    the
    menu to set the recordsource of the subform control
    (Me!nameOfSubfo rmControl.Form. Recordsource = "SFrmMySubformN ame1").
    You can
    tinker with the properties of the subform control so that the subform
    control is transparent and all you see is the current subform.
    Let's say you need three different subforms. Create each subform and
    name
    them:
    MySubform1
    MySubform2
    MySubform3
    On the right side of your main form, add a subform control (from the
    toolbox) and name it MySubformContro l. At this point, do not enter a
    source
    object for the subform control. For your menu you could use an option
    group
    with three options. Name the option group MyOptionGroup. Put the
    following
    code in the Afterupdate event of the option group:
    Select Case Me!MyOptionGrou p
    Case 1
    Me!MySubformCon trol.Form.Sourc eObject = "MySubform1 "
    Case 2
    Me!MySubformCon trol.Form.Sourc eObject = "MySubform2 "
    Case 3
    Me!MySubformCon trol.Form.Sourc eObject = "MySubform3 "
    End Select
  • veteranwebdesign

    #2
    Re: Subform Control

    The main goal is to have a menu on the left and open different
    subforms on the right. Doesn't have to be subforms, some are unbound
    and some aren't.

    Comment

    Working...