Results 1 to 5 of 5
  1. #1
    Join Date
    Jun 2004
    Posts
    6

    Unanswered: Collapse a subform when not in use?

    Hi all,

    another quick subforms question:

    I currently have 1 subform embedded in my mother-form. It all looks very pretty, but I plan to embed multiple additional subforms in the near future. It will get pretty ugly, requiring a lot of vertical scrolling, so I want to "collapse" the subforms, showing only the title (or similar), which can be expanded to show that single subform for data-entry. Once the user is done with that subform, he/she can collapse it again, and expand the next subform.

    In this way, I suppose it would be similar to a tabbed spreadsheet workbook in excel i.e. only the portion of interest is visible at any one time. Is this possible? I sure hope so......

    Thanks, Lee.

  2. #2
    Join Date
    Feb 2002
    Posts
    108
    You could use the tab control to place each subform on a different tab.

    You could put a bottom above each subform and when the user clicks the button it changes the height of the subform.
    Ex. make the 'on click' property of a button [subformname].height=1440 and either make the property of the next subform button change the height on this form back to original size or make the property of this button create a variable like 'dim subform1height' and then specifiy the size and make the routine look at the 'subform1height' and if it is large change it back.

  3. #3
    Join Date
    Apr 2004
    Location
    Sydney Australia
    Posts
    369
    I have 2 subforms on one of my forms and both exactly overlay each other. On the Masterform I have 2 labels with macro OnClick to make the appropriate one visible or invisible.

    When you click on the label to make the chosen subform visible the forecolour of the label changes. When the Masterform is opened one of the subforms is visible by default and the label that is clicked on to make it visible has its forecolor set to be the same colour as when that label is clicked.

    Mike

  4. #4
    Join Date
    Dec 2002
    Location
    Préverenges, Switzerland
    Posts
    3,740
    i don't like tab controls.
    i don't like scrolling forms.
    i don't think i would like collapsed subforms either but i haven't seen any.

    how about bunch of labels dressed up to look like some sort of menu ( a bit of 3D effect here & there) sitting in the mother form and the _click() of each label switches the .sourceobject

    given the subform sitting in a "hole" called "mySubFormHole" and
    a bunch of labels "Details" "Summary" "Reports" etc on the mother and wanabee subforms "frmDetails", "frmSummary" etc

    private Details_Click()
    Me!mySubformHole.SourceObject = "frmDetails"
    end sub

    private Summary_Click()
    Me!mySubformHole.SourceObject = "frmSummary"
    end sub

    etc....

    you could do this with a custom menu bar but it's such a pain to do menus in A.


    izy
    currently using SS 2008R2

  5. #5
    Join Date
    Nov 2003
    Posts
    1,487
    I agree with izy...I think a series of labels would be the way to go and if at all possible, a single subform with source changes to display the subform you want.

    if you actually want to give a expanding or collapsing effect then try something like this in the OnClick event of your Label(s) control(s):


    Code:
     Dim i As Long
      If Me.mySubFormControlName.Height = 0 Then
    	  Me.mySubFormControlName.BorderStyle = 1
    	  For i = 1 To DesiredHieghtOfSubFormControlInInched * 1440 Step 300
    		 Me.mySubFormControlName.Height = i
    		 If i > DesiredHieghtOfSubFormControlInInched * 1440 Then i = DesiredHieghtOfSubFormControlInInched * 1440
    	  Next i
       Else
    	  For i = Me.mySubFormControlName.Height To 0 Step -400
    		 Me.mySubFormControlName.Height = i
    		 Me.Repaint
    	  Next i
    	  Me.mySubFormControlName.BorderStyle = 0
    	  Me.mySubFormControlName.Height = 0
       End If

    You can change the expand/collapse speed by modifying the Step number.


Posting Permissions

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