DoCmd.MoveSize

lmcc007

Registered User.
Local time
Today, 16:56
Joined
Nov 10, 2007
Messages
635
I am trying to use Docmd.MoveSize to have my forms and reports display where I want them.

Is there a way to get the exact measurement of your form or report? Meaning, when I manually move the form to the exact position I want it to display, I would like to get the twips so I can add them to the Docmd.MoveSize code.
 
lmcc,

There probably is a way to do it, using a Windows API call of some sort - I don't know the details. But otherwise you should be able to get it pretty right by a bit of experimentation. 1cm = 567 twips. Give it a try and see where it ends up. Rinse and repeat.
 
You can also use Debug.Print txtbox1.Height or Msgbox if you don't know Debug.Print. That will return the twips.
 
lmcc,

There probably is a way to do it, using a Windows API call of some sort - I don't know the details. But otherwise you should be able to get it pretty right by a bit of experimentation. 1cm = 567 twips. Give it a try and see where it ends up. Rinse and repeat.

Got it the old fashion way--that is, using my ruler and got 2.5 inch then I added 1440+1440+720 and so on.

Thanks!
 
On the click event of any control:

Msgbox Me.Height
 
On the click event of any control:

Msgbox Me.Height

Even if it's a report or form? I just did it for the report and every time I click it just gets bigger or small--the zoom works not the msgbox.
 
Anything below Access 2007 doesn't have interactivity on the reports so you can put it on the Load event of the form.

If you have Access 2007 and above then you can open the report in Report View mode and the click event will work.
 
Anything below Access 2007 doesn't have interactivity on the reports so you can put it on the Load event of the form.

If you have Access 2007 and above then you can open the report in Report View mode and the click event will work.

Did it but received the error message:

Run-time error '2455':

You entered an expression that has an invalid reference to the property Height.
 
Come to think of it, why do you want to know the height of your report? It wouldn't actually work in report view because your report would have no height. It's a rather unusual request.
 
Come to think of it, why do you want to know the height of your report? It wouldn't actually work in report view because your report would have no height. It's a rather unusual request.

I just tried it again and got the same error.

I was trying to get the position of the report when displayed on the screen. Each time the report opens I would have to move it. So, I used my ruler to get the measurement for DoCmd.MoveSize. I just did it all manually using my ruler.
 
Yes, as mentioned in my last post it wouldn't work. Is your report a pop-up report?

You can try it on the Print event of the form.
 
Yes, as mentioned in my last post it wouldn't work. Is your report a pop-up report?

You can try it on the Print event of the form.

Yes it is a pop-up report. Just tried it again and it doesn't work--when clicked it zooms in or out.
 
Oops.. I meant On Page event of the form.

Okay, that worked. It gave me the Height. But, I was interested in the position, that's why I was using the ruler to tell it to come down so many twips.
 
Height was used as an example. A form has other properties, there's WindowLeft and WindowTop.
 
Height was used as an example. A form has other properties, there's WindowLeft and WindowTop.

That's what I wanted--WindowLeft and WindowTop. Tried it and it works. Thanks!
 
lmcc,

Got it the old fashion way--that is, using my ruler and got 2.5 inch then I added 1440+1440+720 and so on.

Yes, that is absolutely the way I would do it. Very quick and easy. If that doesn't put it exactly where you want it, then just adjust the figures and try again until you get it right.
 

Users who are viewing this thread

Back
Top Bottom