• Dynamically size form

    Author
    Topic
    #355858

    Hi Everyone!

    In Access 97, does anyone know if there is any way to dynamically resize a form?

    For instance, I have a form with a report selector (combo) on it. One choice is a canned report, the other choice is a custom report. I have put all of my custom selections in the form footer, and if the canned report is chosen, the footer becomes invisible. (and if the custom report is chosen, the footer shows again)

    What I’d like to do is take it one step further and have the form size to its new size. If, from that screen, you manually select Size to Fit Form, the form will reduce/expand. But is there any way to do this programmatically?

    Thanks!

    Cecilia 🙂

    Viewing 0 reply threads
    Author
    Replies
    • #525740

      Hi Cecilia,

      Check out the InsideHeight and InsideWidth properties of the form. Post back if you need more specific information or an example.

      HTH thumbup

      • #525753

        Hi Mark–

        That’s a really cool example, but I can’t seem to get it to work. I pretty much used the example from the help file:

        Sub ResetWindowSize(frm As Form)
        Dim intWindowHeight As Integer
        Dim intWindowWidth As Integer
        Dim intTotalFormHeight As Integer
        Dim intTotalFormWidth As Integer
        Dim intHeightHeader As Integer
        Dim intHeightDetail As Integer
        Dim intHeightFooter As Integer

        ‘ Determine form’s height.
        intHeightHeader = frm.Section(acHeader).Height
        intHeightDetail = frm.Section(acDetail).Height
        intHeightFooter = frm.Section(acFooter).Height
        intTotalFormHeight = intHeightHeader + intHeightDetail + intHeightFooter
        ‘ Determine form’s width.
        intTotalFormWidth = frm.Width
        ‘ Determine window’s height and width.
        intWindowHeight = frm.InsideHeight
        intWindowWidth = frm.InsideWidth

        If intWindowWidth intTotalFormWidth Then
        frm.InsideWidth = intTotalFormWidth
        End If
        If intWindowHeight intTotalFormHeight Then
        frm.InsideHeight = intTotalFormHeight
        End If
        End Sub

        And then did ResetWindowSize Me in the after update of the combo that controls the form size.

        I kind of expected this to work, as the footer (and detail) is set to both can grow and can shrink, and the form is set to autoresize. Somehow, though, it didn’t respond to this. Maybe I missed something?

        Cecilia 🙂

    Viewing 0 reply threads
    Reply To: Dynamically size form

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: