Results 1 to 3 of 3
  1. #1
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    San Francisco, California, USA
    Posts
    358
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Dynamically size form

    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 :-)

  2. #2
    Silver Lounger
    Join Date
    Jan 2001
    Location
    Indianapolis, Indiana, USA
    Posts
    1,862
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Dynamically size form

    Hi Cecilia,

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

    HTH <img src=/S/thumbup.gif border=0 alt=thumbup width=15 height=15>

  3. #3
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    San Francisco, California, USA
    Posts
    358
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Dynamically size form

    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 :-)

Posting Permissions

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