Form.Move method (Access)

Moves the specified object to the coordinates specified by the argument values.

Syntax

expression.Move (Left, Top, Width, Height)

expression A variable that represents a Form object.

Parameters

Name Required/Optional Data type Description
Left Required Variant The screen position in twips for the left edge of the object relative to the left edge of the Microsoft Access window.
Top Optional Variant The screen position in twips for the top edge of the object relative to the top edge of the Access window.
Width Optional Variant The desired width of the object in twips.
Height Optional Variant The desired height of the object in twips.

Remarks

Only the Left argument is required. However, to specify any other arguments, you must specify all the arguments that precede it. For example, you cannot specify Width without specifying Left and Top. Any trailing arguments that are unspecified remain unchanged.

This method overrides the Moveable property.

If a form is modal, it is still positioned relative to the Access window, but the values for Left and Top can be negative.

In Datasheet view or Print Preview, changes made by using the Move method are saved if the user explicitly saves the database, but Access does not prompt the user to save such changes.

Example

The following example determines whether the first form in the current project can be moved; if it can, the example moves the form.

If Forms(0).Moveable Then 
    Forms(0).Move _ 
       Left:=0, Top:=0, Width:=400, Height:=300 
Else 
    MsgBox "The form cannot be moved." 
End If

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.