I've been making progress with the help of the experts here to resize subforms. I have a main form (frmnewestimates) that gets maximized at load time, The subforms have been hard coded to their positions and are not maximizing with the main form. There are two subforms. The Tasks subform is on top of the Effort Sub form.
I have the following code working to widen the sub forms to the max:
Me.sfrmTasks.Width = Me.InsideWidth
Me.sfrmEffort.Width = Me.InsideWidth
Now I would like to dynamically assign the height to the sub forms so that the Tasks subform gets 40% of the space, and the Effort subform gets the remain space, which works out to about 32% of the total InsideHieigt of the main form, leaving the rest for the Main form header and footer.
I'm able to set the height of the Tasks subform only by using the following code in the sub form's ON LOAD event:
Me.InsideHeight = Forms!frmnewestimates.InsideHeight * 0.4241
The problem I run into now is setting the Top position and height for the second subform (Effort) that goes directly under the first subform (Tasks). I've tried the following Main form ON LOAD event:
Me.sfrmEffort.Top = Me.sfrmTasks.Top + Me.sfrmTasks.Height + 200
Me.sfrmEffort.Height = Me.InsideHeight * 0.32
I've tried setting the Top and Height with hard coded numbers, but I just can't get it to budge that subform. Any ideas how to position that subform properly? I've tried to do it from the subform's ON LOAD, but there is no TOP value available to set.
Thanks!!!
< 32%> ... well, maybe on the resolution you are developing in but you really should finish out the math using the actual control positions ... always make sure if you are adding / subtracting the bits and pieces that you nest them or make sure the order your logic matches VBA's order of math operations.
Me.sfrmEffort.Height = 0
Me.sfrmEffort.Top = Me.sfrmTasks.Top + Me.sfrmTasks.Height + 200
Me.sfrmEffort.Height = Me.InsideHeight - Me.sfrmEffort.Top + 200