Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How t get the height of form 1

Status
Not open for further replies.

jamaarneen

Programmer
Dec 27, 2007
213
BE

Hi

It seems to be simple, but I would like somebody to tell me: how can i get the height of current form (not the detail section)? I only see a "width" property" for the form, but no height.

(What I am trying to achieve, is to resize the form after clicking a button, so more controls/textboxes will be visible. i want to usy the DoCmd.MoveSize, and make NewSize=OldSize+SomeControl(s)Height)

Thanks
Ja
 
Good question. I dont have access on this PC so can't test but can you simply add together the heights of the header, detail and footer? From recollection, they all have height properties?

Good luck mate, JB
 
PS. Besides, unless you have controls in the header/footer, it's the detail you'll want to adjust anyway? And even if you do have controls in other sections, it's those you'll need to adjust instead?

PPS. Again, without Ms Access in front of me I can't check but dont forget these things normally involve twips, not cm. 1cm=567 twips.
 

Hi JB,

Thanks for your suggestion. I tried it and it worked perfect.

I'm still wondering, if there isn't any simpler way to get a form's height.

Ja
 

Hi again, I just saw your second reply.
You are right, it is only the detail section I want to change, but the thing is that I want that in the begin the form should appear taller then the detail's size (what I cannot make smaller, because the all the controls - yet not visible - in the detail section).
So I decided to make the form's size smaller - and of course, "Border Style" is NOT sizable.

Thanks, Ja

 
Couple of reasons:

A form is typically constituded of those three components. All are the same width of course, hence a form has a .width property. But each of the sections could be of variable height. Therefore whilst having a funtion to GET that height would be kinda feasable, SETTING that height would be impossible as there would be no way to know which section receive that height increase/decrease

Also, a form can be set to "Sizeable". In this instance the developer often wants one section of the form to retain a particular height and cut off the view to other parts of the form without unless scrolled to.

Have a play, you'll see it's the only logical solution MS could provide us with.

Final point, if you're gonna be doing this a bit, write yourself a funky function along lines of:

Code:
GetFormHeight(frmTarget as form) as long
'logic to sum heights of form sections
getformheight=result of above
end function

then you dont have to do your sums everywhere, you can just call that :)

Happy Dayz,

JB
 

Thanks JB for the explanation about the form-height issue.
I LOVE explanations!

Ja
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top