setting detail section height at run time

TomL

Registered User.
Local time
Today, 09:47
Joined
Aug 11, 2010
Messages
18
I'm trying to set the height of the detail section of my form at run time. I have a number of fields that I set visible property to false and want to expand the size of the detail section and set the fields to visible = true, when the user clicks a value on a option button.
I tried to set the initial detail section height on the open event as in Form.Section("Detail").Height = 1.4, without success. I'm not sure if this is because the form already has fields or my syntax is wrong.
Any help would be appreciated.

Thanks,
Tom
 
I'm not clear on what is exactly going wrong, but what I think you are saying that the section height did not change to the specified value.

First, 1.4 is too small - though we may use inches on property sheets, we use twips in the VBA... 1440 twips to an inch.

Secondly, my memory (which can be wrong) says you cannot shrink the section's height to be smaller than than the largest .Top + .Height of any given control (e.g. no smaller than the bottom edge of bottommost controls. Visiblity has nothing to do with it.

Last time I needed to do some runtime resizing, I chose to use a subform embedded in the section detail and increased the subform's height (which will also automatically increase the section's height to fit) as needed. Do also note that there's a hard limit of 22 inches. (22 * 1440 in VBA)

HTH.
 
Thanks for the reply. I got the height value from moving the detail bar to the height I wanted and looked at the height value, which was 1.4". That said, I went back in and set the value to twips, ran the form, but without success.
I think you're probably correct in as much as; if there are controls on the form, no matter what the visible property is set, the height of the section can be no less then the lowest control height. I did notice that when I had the controls in place on the form I could not move the detail bar beyond the lowest control. Too bad though it would have made the form look better to be able to move the height rather then have all that blank space until you have to show the controls.

Regards,
Tom
 
FWIW -

I'm not a big fan of hiding controls - I'd prefer to simply disable the controls - this is more useful feedback to my users than having controls that magically appear out of nothingness then suddenly disappear.

But I can see a case for "slider tray", which I think is what you want. In that case, you would just use a subform, which can be then set to zero height and thus detail section can be likewise set to zero as well and sized to just the size you want.

HTH.
 
HTH,
Good thoughts. I'll look at both suggestions for my solution.

Regards,
Tom
 

Users who are viewing this thread

Back
Top Bottom