How object.HEIGHT scale is different from object.TOP?...

  • Thread starter Eugene via AccessMonster.com
  • Start date
E

Eugene via AccessMonster.com

Hi all,

Please tell me if anyone of you has an idea of how object's HEIGHT property
is different from the TOP in terms of scaling or units of measure? What I am
trying to accomplish is like getting 2 subforms resized to fit screen but at
the same time keep lower object's height unchanged:

Before:
+-------------------+
| |
+-------------------+
| |
+-------------------+

After:
+-------------------+
| |
| |
| |
+-------------------+
| |
+-------------------+


Sub Form_Open '--- Just to resize height
DoCmd.Maximize
Me.object1.Height = Me.WindowHeight - me.object2.height - 50
Me.object2.Top = Me.object1.Top + Me.object1.Height + 50
End Sub

Running this code generates run-time error 2100 (The control or subform is
too large for this location).

Who's got a clue for this?....
 
E

Eugene via AccessMonster.com

Maybe this will look better:

Before:
+-------------------+
| |
+-------------------+
| |
+-------------------+

After:
+-------------------+
| |
| |
| |
+-------------------+
| |
+-------------------+
 
D

Damon Heron

How about this - use a variable to assign the twips calculation then make
the top property = to the variable:

Dim x As Integer
DoCmd.Maximize
Me.subform1.Height = Me.WindowHeight - (Me.subform2.Height - 50)
x = Me.subform1.top + (Me.subform1.Height + 50)
Debug.Print x
Me.subform2.top = x

HTH
Damon
 
M

Marshall Barton

Eugene said:
Please tell me if anyone of you has an idea of how object's HEIGHT property
is different from the TOP in terms of scaling or units of measure? What I am
trying to accomplish is like getting 2 subforms resized to fit screen but at
the same time keep lower object's height unchanged:

Before:
+-------------------+
| |
+-------------------+
| |
+-------------------+

After:
+-------------------+
| |
| |
| |
+-------------------+
| |
+-------------------+


Sub Form_Open '--- Just to resize height
DoCmd.Maximize
Me.object1.Height = Me.WindowHeight - me.object2.height - 50
Me.object2.Top = Me.object1.Top + Me.object1.Height + 50
End Sub

Running this code generates run-time error 2100 (The control or subform is
too large for this location).


Use the InsideHeight property instead of WindowHeight.
WindowHeight includes the form's border, title bar, scroll
bars, etc.
 
D

Damon Heron

Yah, I spoke too soon. If you step thru the code then it works, but not at
run time. Marshall is right about the inside height property, or you could
just assign a variable to that calculation: Me.subform1.Height = y -
(Me.subform2.Height - 50)
Damon
 

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