Matt Hall
Matt Hall

Reputation: 2412

Maximizing MS-Access Application Not Applying Update to Subform's width property

I have a subform called "SprintTicket_Work_subform" on a main form called "Home". I have been playing with the main form's On Resize event to try to get the subform to grow proportionally up to a point based on the size of the window at time of resizing.

Here's the work-in-progress VBA for that (it's primarily trying to get around the issue that big monitors pose when trying to use a twip value that is greater than the 32767 value an integer datatype can hold).

    Dim sub_w As Long
    Dim win_w As Long
        
    If _
        Me.WindowWidth <= 32767 And Me.WindowWidth > 0 _
    Then
        win_w = Me.WindowWidth
    Else
        win_w = 32767 + (32767 - Abs(CLng(Me.WindowWidth)))
    End If
    
    If _
        win_w - 910 > 21446 And win_w - 910 <= 32767 _
    Then
        sub_w = win_w - 910
    ElseIf _
        win_w - 910 > 32767 _
    Then
        sub_w = 32767
    Else
        sub_w = 21446
    End If
    
    Me.SprintTicket_Work_subform.Width = sub_w

The integer issue isn't so much the problem though as the Me.SprintTicket_Work_subform.Width = sub_w part works fine resizing the subform if I am resizing my MS-Access window by dragging the right edge of the window out.

If I click the maximize button, however, the subform width does not seem to render/update (on screen at least).

I've done debug.print in various places of my VBA and this would suggest that the maximize button is at least triggering the On Resize event. It just doesn't appear to be rendering the resizing of the subform.

Is there something else I need to do if I want the subform to resize using my VBA when clicking the maximize button?

Upvotes: 0

Views: 41

Answers (0)

Related Questions