Form size reduction beyond content

Is this set in the OnOpen event?
 
Ah super job. I'm actually using that command rather than the Me.InsideHeight code and works a treat. You are a star thanks.
 
Just had a thought of how I could have approached this without the need to resize the window....I could have just put the out of range section on a new tab!! Oh well at least I know how to resize and postition a form window now ;)
 
I can't post links yet, but if you do a search on this site for "VBA assistance to allow sub-form to grow ("can grow" does not work)"(thread number 166845) you will find a response that allowed me to do something similar, I believe.

I had controls on the bottom right of the form, and a large subform in the middle. I wanted to show the minimal required data, yet allow the user to resize the form to view all the data in the subform at once. But if I allowed the subform to grow, I knew I needed to move the buttons as well. I also made sure that the form wouldn't shrink too small.
Here is my adaptation of the code:

Private Sub Form_Resize()
Const LeftRightPadding = (0.125 + 0.125) * 1440
Const TopBottomPadding = (1.54 + 0.75) * 1440
'Ensure window is not shrunk too small
If Me.InsideWidth < (4.58 * 1440) Then Me.InsideWidth = (4.58 * 1440)
If Me.InsideHeight < (5.5 * 1440) Then Me.InsideHeight = (5.5 * 1440)
Me.FCOMMENT_CREATE_SUBFORM.Height = Me.InsideHeight - TopBottomPadding
Me.FCOMMENT_CREATE_SUBFORM.Width = Me.InsideWidth - LeftRightPadding
Me.cmdAdd.Top = Me.InsideHeight - (0.4 * 1440)
Me.cmdCancel.Top = Me.InsideHeight - (0.4 * 1440)
Me.cmdAdd.Left = Me.InsideWidth - (2.4 * 1440)
Me.cmdCancel.Left = Me.InsideWidth - (1.25 * 1440)
Me.lblRecords.Top = Me.FCOMMENT_CREATE_SUBFORM.Height + Me.FCOMMENT_CREATE_SUBFORM.Top + 50
Me.txtRecords.Top = Me.FCOMMENT_CREATE_SUBFORM.Height + Me.FCOMMENT_CREATE_SUBFORM.Top + 50
End Sub
 

Users who are viewing this thread

Back
Top Bottom