[AccessD] What is wrong with this code?

Michael Brösdorf michael.broesdorf at web.de
Tue Jun 24 13:32:53 CDT 2003


Dear group,

I am still having problems with my form resize code. I have a subform in the
detail section of a form. The form header is ampty and the form footer
contains a couple of command buttons.

The main form is resizable and the size of the subform should be adjusted
accordingly. That works fine for the most part.

But: If a user drags the _upper_ edge of the window towards the bottom of
the window, the window moves downward. If the upper edge reaches the initial
position of the lower edge the window suddenly jumps around and I get an
error message 2100 (Control or subform too big...).

Any ideas are much appreciated!

Here is the complete code of the form's resize event:


Private Sub Form_Resize()
On Error GoTo PROC_ERR

    Const clngMinH = 5600
    Const clngMinW = 8500

    'Debug.Print Me.InsideHeight, Me.WindowHeight, Me.InsideWidth,
Me.WindowWidth
    'Debug.Print IsIconic(Me.hwnd)

    'Check if form has been minimized
    If IsIconic(Me.hwnd) <> 1 Then

        'Enforce minimum height of form
        If Me.InsideHeight < clngMinH Then
            Me.InsideHeight = clngMinH
        End If

        'Enforce minimum width of form
        If Me.InsideWidth < clngMinW Then
            Me.InsideWidth = clngMinW
        End If

        'Set height of detail section
        Me.Section(0).Height = Me.InsideHeight - 800

        'Set height/width of subform
        Me.sfrmList.Height = Me.InsideHeight - 800 - 2 * Me.sfrmList.Top
        Me.sfrmList.Width = Me.InsideWidth - (2 * Me.sfrmList.Left)

    End If

PROC_EXIT:
    Exit Sub

PROC_ERR:
    Select Case Err.Number
    Case 2100:
        'Ignore this error

    Case Else
        myErrMsg Err, Me.Name & ":Form_Resize"
    End Select
    Resume PROC_EXIT
End Sub



More information about the AccessD mailing list