How to reposition a form in Access through code?

2019-07-28 22:28发布

I want to move a form to the screen's left side in Access 2007 in the onOpen event. I've not found how to do it using form properties, because top and left properties seems to be read only through code during runtime.

Do I need call API methods to move a form in Access to another position on screen? Is there a quick way to do it?

1条回答
Bombasti
2楼-- · 2019-07-28 23:11

Look at Access' Help topic for the Move method.

This sample is code behind a command button which will re-position the current form. If you supply the Width and Height arguments, you can also use Move to resize the form.

Private Sub cmdMoveForm_Click()
    'Me.Move Left:=0, Top:=0, Width:=400, Height:=300 '
    Me.Move Left:=2970, Top:=1860
End Sub

Note the numbers are in twips: 1440 twips per inch; or 567 twips per centimeter.

查看更多
登录 后发表回答