Results 1 to 4 of 4
  1. #1
    Join Date
    Jul 2004
    Posts
    6

    Question Unanswered: Subform Position Change on Tab Click

    I have created several tabbed subforms on a main form. When I click on any of the subform tabs and the subform gets the focus, the subform automatically is positioned at the top of the screen and I am forced to use the scroll bars to view the main form (that is above and off-screen). I would like the top of the main form to stay positioned and displayed at the top of the screen with the subforms maintaining their position when they get focus. Any suggestions greatly appreciated

  2. #2
    Join Date
    Dec 2002
    Location
    Préverenges, Switzerland
    Posts
    3,740
    sorry i can't directly answer your question.

    but

    you are already working with subforms: switch the .sourceobject of the subform-control and you have all the flexibility of tabs without the annoying behaviour of tabs.

    izy
    currently using SS 2008R2

  3. #3
    Join Date
    Jul 2004
    Posts
    6
    Izy
    Not sure I understand, but sounds like that may help. I'm probably not as advanced as you. I used the Wizard to create the subform. Perhaps you could please explain how to "switch the .sourceobject" - Thanks for you help.
    amg

  4. #4
    Join Date
    Dec 2002
    Location
    Préverenges, Switzerland
    Posts
    3,740
    i'll try:

    split the one-subform-with-many-tabs into as many independent forms as you have tabs. lets pretend you have named these new forms "sfTab1", "sfTab2" etc

    you will need some navigation in the "mother form": labels do well enough, and you can capture their _Click() event. lets pretend these labels are called "tab1", "tab2" etc.
    (if you want to get fancy you can create custom menus but it is a pain to do - users are not shocked to click labels for navigation since this is how most of their internet experience is - and labels are so much easier)

    in the mother form, design view, click once in the "hole" that the subform lives in and note /properties/other/name ...most likely the wizard will have named this the same as the original tabbed subform - it is a good idea to rename it to avoid confusion - let's pretend you rename the subform hole "sfHole1"
    whilst you are in properties - look at the SourceObject section: that is what is going to show in the subform hole when the form first loads

    now in the mother form code:

    private sub tab1_Click()
    me!sfHole1.sourceobject = "sfTab1"
    end sub

    Private sub tab2_Click()
    me!sfHole1.sourceobject = "sfTab2"
    ....etc

    why?

    it annoys me to hell and back to have odd shapes and styles of forms leaping about the screen in typical access fashion.

    if you design your application around a single mother form holding navigation and you have all the action taking place in one or more subforms on the mother, the user has a more consistent visual experience and you have as many related or unrelated "tabs" to play with as you want (without the sometime strange behaviour of tabs).

    you can do lots of nice things with .sourceobject

    ...for example have the default subform at startup show your logo, application revision, copyright notice etc

    ...for example two levels of navigation - the "major" level switches .sourceobject in another subform containing your "minor" navigation.
    you now have hundreds of navigation bars possible.
    (switching .sourceobject insfHole1 from another subform is a couple of words more complicated: from code in the "minor" navigation subform:
    forms!motherForm!sfHole.sourceobject = "menu345")

    try it. hope you like it.

    izy
    currently using SS 2008R2

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •