"Auto Height" vs. "Can Grow" / "Can Shrink"

otto

New member
Local time
Today, 11:56
Joined
Aug 29, 2019
Messages
12
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


 
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.
 
cangrow also only works when printing a form (or report) it has no effect on a form viewed onscreen
 
@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.
 
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?
 
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

Back
Top Bottom