"Auto Height" vs. "Can Grow" / "Can Shrink" (2 Viewers)

otto

New member
Local time
Yesterday, 19:02
Joined
Aug 29, 2019
Messages
6
Hello everybody!


I can't grasp the difference between "Auto Height" and "Can Grow" / "Can Shrink" properties which are available for some sections in reports and forms like detail section. The MS help wasn't clear.


As I understand it, "Auto Height" is the same as the other two together. Is it really so?


AutoHeight:
https://docs.microsoft.com/en-us/previous-versions/office/developer/office-2007/bb225494(v=office.12)?redirectedfrom=MSDN


CanGrow:
https://docs.microsoft.com/en-us/previous-versions/office/developer/office-2007/bb225499(v=office.12)?redirectedfrom=MSDN


CanShrink:
https://docs.microsoft.com/en-us/previous-versions/office/developer/office-2007/bb225500(v=office.12)?redirectedfrom=MSDN


Thanks for any clarification.


Otto


 

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 19:02
Joined
Oct 29, 2018
Messages
21,358
Hi Otto. They could be doing the same thing, or at the very least, they are having the same effect. But the way I understand it, AutoHeight depends on the sizes of the controls in the section, and CanGrow depends on the data contained in the control.
 

CJ_London

Super Moderator
Staff member
Local time
Today, 02:02
Joined
Feb 19, 2013
Messages
16,553
cangrow also only works when printing a form (or report) it has no effect on a form viewed onscreen
 

Minty

AWF VIP
Local time
Today, 02:02
Joined
Jul 26, 2013
Messages
10,355
@CJ - Can grow does work on a report view and a report viewed IN a form. It's good way of varying the height of a memo type field within a form for viewing purposes.

But correct it doesn't work at all on a normal form.
 

CJ_London

Super Moderator
Staff member
Local time
Today, 02:02
Joined
Feb 19, 2013
Messages
16,553
my bad - should have said report view:)
 

otto

New member
Local time
Yesterday, 19:02
Joined
Aug 29, 2019
Messages
6
Hello everyone,


Thank you all for your answers.


Okay now I understand it, at least theoretically. So I I've created a form with formheader visible to see it in action. The AutoHeight property for the formheader is set to Yes. At the bottom of the form I put a textfield (init height 300) who's height I set in VBA.


Code:
Private Sub cmdResizeField_Click()
Me.txtFieldToResize.Height = Me.txtFieldHeight.Value
End Sub
Now if I set the height of the textfield to say 1000, the formheaders height grows correctly. However if I set the height of the textfield back to say 100, the height of the formheader does not shrink as I would expect it.


Is this a bug or a feature ;) or do I miss something?
 

Pat Hartman

Super Moderator
Staff member
Local time
Yesterday, 22:02
Joined
Feb 19, 2002
Messages
42,981
The use of Auto Height is unclear at best. It seems to do what CanGrow does but clearly there is some subtle distinction. Maybe it is relevant when you print a form. Unless you have time to investigate, just stick with CanGrow and CanShrink since we know what they do.
 

CJ_London

Super Moderator
Staff member
Local time
Today, 02:02
Joined
Feb 19, 2013
Messages
16,553
if you want to adjust a section height (header/detail/footer) after reducing the height (or top) of the lowest control, just set its height to 0 - it will then default to the minimum height it can given the bottom of the lowest control. e.g.


(header) section height=2000
lowest control - top 1500, height 300

me.header.height=0

will change the header height to 1800

edit: the above is aircode

header is me.section(1)
footer is me.section(2)
detail is me.section(0)
 

Users who are viewing this thread

Top Bottom