Link to home
Start Free TrialLog in
Avatar of Kaprice
KapriceFlag for United States of America

asked on

MS Access 2010 - Maximize subform on Main form resize

I'm looking for (hopefully simple) sample code to maximize a subform within the Detail section of a main form whenever the main form resizes.

Seems it should be simple, but it's eluding me.
ASKER CERTIFIED SOLUTION
Avatar of Scott McDaniel (EE MVE )
Scott McDaniel (EE MVE )
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Put this code into the main form's Resize event:
    Const LeftRightPadding = (0.125 + 0.25) * 1440
    Const TopBottomPadding = (0.65 + 0.375) * 1440
   
    Me.sfrmClient.Height = Me.InsideHeight - TopBottomPadding
    Me.sfrmClient.Width = Me.InsideWidth - LeftRightPadding

You'll need to change the subform references and play with the numbers in the constants.  The top and bottom padding are the most difficult to adjust.  The distance from the top of the main form plus the size of the header will impact the numbers.
Avatar of Kaprice

ASKER

That did the trick. I didn't know 2010 had added Anchoring. Thanks much!

(the other expert answer deserves kudos for pre-2010 versions. Thanks both)