DoCmd.MoveSize

C

Chad

Hello, I have a form that has a chk box defult true and when I uncheck it it
makes the form width smaller. I want to be able to make the heigth taller ar
smaller as well. How would I acomplish this? Here is the code im using to
change the width:

Option Compare Database
Option Explicit

Const FORM_SHRUNK = 4000 * 3.8
Const FORM_BIG = 8640

Private Sub chkPreview_AfterUpdate()

If Me!chkPreview Then
DoCmd.MoveSize , , FORM_BIG
Else
DoCmd.MoveSize , , FORM_SHRUNK
End If

End Sub
 
B

BruceM

Unless you are going to reuse the numbers there is no real need to declare
them as constants, although there is no problem with doing so other than
extra work. You just need to add the height argument to MoveSize. The
leading commas are placeholders for Top and Left (position on the screen).
After that is width, which you have, but not height. Without constants you
may have something like:

DoCmd.MoveSize , , 4000, 2000

MoveSize uses units called twips. There are 1440 twips per inch, so
multiplying inches by 1440 will give you the size (and position) in inches.
For a 4" by 2" form:

DoCmd.MoveSize , , 4 * 1440, 2 * 1440
or
DoCmd.MoveSize , , 5760, 2880

Help seems to state that the MoveSize units are inches or centimeters
depending on your regional settings, but that doesn't seem to be accurate
information. That being said, take a look at VBA Help about MoveSize.
 

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