Resizing a subform in a Tab Control????

A

amanda_jb

I have one form in my Database that is just to big for my current tab
selections. My plan was, using the move method, to resize the form and tab
control size when changed (or moved to this tab) and then back after the tab
was changed again. I simply can't figure out how to resize though and I'm
pulling my hair out. I simply determined the locations by the property view,
but when I run the code, it sends the suform off the screen somewhere (I did
a border color change to try and find it, it seems its way off to the top
left). When just adjusting the Height of the Subform, it will show very the
bottom subform, as it seems it goes to 'Top'.

Can anyone PLEASE tell me how I can go about doing this??
 
G

Golfinray

Remember that a tab is a "holster". The form or subform sits in the holster.
The holster has properties. The form has properties. If you want to make the
tab larger, you have to grab the OUTSIDE (the holster) with your mouse and
drag it larger. If you want to make the form larger, you grab the INSIDE with
the mouse and drag it.
 
A

amanda_jb

Thank you for answering.. I'm actually trying to do this in form view (not
design) when you select the tab where this subform is located. The form is
too big to view all the information and in hopes to keep my form looking
nice, I don't want to have a huge tab/page with little information just so
this one form will be viewable, so I was hoping I could use the MoveMethod
code when selecting this tab. Does that make any sense?? I don't even know
if its possible, but I have been able to move and resize the form, but the
size I'm entering / locations go off the screen.
 
G

Graham Mandeno

Hi Amanda

Both the tab control and the subform control have Height and Width
properties. You can adjust these through VBA code in form view by simply
assigning new values to them:

Me.ControlName.Height = NewValue
Me.ControlName.Width = NewValue

The unit is the "TWIP" (one TWentieth of a Point). There are 72 points to
an inch and therefore 1440 TWIPs to an inch, so you do the maths.

Coming from a country where we use metric measurements, I find this function
useful:

Public Function CmToTwips (cm as Single) as Long
CmToTwips = cm * 1440 / 2.54
End Function

Note that it rounds to the nearest integer because all form/report
measurements are in whole numbers.

You could make it InchesToTwips and omit the / 2.54.

When you resize a control that is contained within another control, you
cannot make the child control's dimensions larger than the parent, and
conversely, you cannot make the parent control's dimensions smaller than the
child.
--
Good Luck :)

Graham Mandeno [Access MVP]
Auckland, New Zealand


For this reason, when making the dimensions larger, resize the parent
control first. When making the dimensions smaller, resize the child control
first.
 
A

amanda_jb

This worked... yea! Thank you so much!!!
--
Amanda


Graham Mandeno said:
Hi Amanda

Both the tab control and the subform control have Height and Width
properties. You can adjust these through VBA code in form view by simply
assigning new values to them:

Me.ControlName.Height = NewValue
Me.ControlName.Width = NewValue

The unit is the "TWIP" (one TWentieth of a Point). There are 72 points to
an inch and therefore 1440 TWIPs to an inch, so you do the maths.

Coming from a country where we use metric measurements, I find this function
useful:

Public Function CmToTwips (cm as Single) as Long
CmToTwips = cm * 1440 / 2.54
End Function

Note that it rounds to the nearest integer because all form/report
measurements are in whole numbers.

You could make it InchesToTwips and omit the / 2.54.

When you resize a control that is contained within another control, you
cannot make the child control's dimensions larger than the parent, and
conversely, you cannot make the parent control's dimensions smaller than the
child.
--
Good Luck :)

Graham Mandeno [Access MVP]
Auckland, New Zealand


For this reason, when making the dimensions larger, resize the parent
control first. When making the dimensions smaller, resize the child control
first.
amanda_jb said:
I have one form in my Database that is just to big for my current tab
selections. My plan was, using the move method, to resize the form and
tab
control size when changed (or moved to this tab) and then back after the
tab
was changed again. I simply can't figure out how to resize though and I'm
pulling my hair out. I simply determined the locations by the property
view,
but when I run the code, it sends the suform off the screen somewhere (I
did
a border color change to try and find it, it seems its way off to the top
left). When just adjusting the Height of the Subform, it will show very
the
bottom subform, as it seems it goes to 'Top'.

Can anyone PLEASE tell me how I can go about doing this??
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top