I want the user to be able to change the height of the form while in Form View by clicking a button:
Private Sub btnChangeHeight_Click()
booTall = Not booTall
If booTall Then
lngHeight = 12400 ' (twips)
Else
lngHeight = 1200
End If
Me.Detail.Height = lngHeight
Me.Repaint
Debug.Print Me.Detail.Height
End Sub
The height changes -- Debug.Print
says so, and a vertical scroll bar appears when booTall
is True
. But the form won't change its vertical dimension onscreen.
I also tried this, without success (making sure my button was on the Form header):
Me.Detail.Visible = booTall
The solution would seem to depend on properties for the Form and Form Detail section: Resizable, Auto Height, perhaps Can Grow, etc. But I've fiddled with those and nothing works.
I understand overlapping controls and other things can prevent height adjustments, so I've reduced the form to a minimal layout. I'm using Access version 2007/2010.
Some additional info: What I actually am working toward is two subforms, (A) above and (B) below, which can independently be collapsed out of view or expanded. This is for a decision-making form with a LOT of data on it. I thought if I collapsed the height of (A) or (B), the CanShrink
property of Detail
would cause the overall form dimension to change. In fact, I think I did this a few years ago using Access 2003. As for using Maximize ... we're setting up this form as re-usable, multiple instances can open.