MoveSize Action

Microsoft Access Visual Basic

Action argument Description Right The new horizontal position of the window's upper-left corner, measured from the left edge of its containing window. Enter the position in the Right box in the Action Arguments section of the Macro window. Down The new vertical position of the window's upper-left corner, measured from the top edge of its containing window. Width The window's new width. Height The window's new height.

If you leave an argument blank, Microsoft Access uses the window's current setting.

You must enter a value for at least one argument.

Note  Each measurement is in inches or centimeters, depending on the regional settings in Windows Control Panel.

Remarks

This action is similar to clicking Move or Size on the window's Control menu. With the menu commands, you use the keyboard's arrow keys to move or resize the window. With the MoveSize action, you enter the position and size measurements directly. You can also use the mouse to move and size windows.

You can use this action on any window, in any view.

Tips

  • To move a window without resizing it, enter values for the Right and Down arguments but leave the Width and Height arguments blank.
  • To resize a window without moving it, enter values for the Width and Height arguments but leave the Right and Down arguments blank.

To run the MoveSize action in Visual Basic, use the MoveSize method of the DoCmd object.

Example

Show Synchronize forms by using a macro

The following macro opens a Product List form in the lower-right corner of the Suppliers form, displaying the current supplier's products. It shows the use of the Echo, MsgBox, GoToControl, StopMacro, OpenForm, and MoveSize actions. It also shows the use of a conditional expression with the MsgBox, GoToControl, and StopMacro actions. This macro should be attached to the Review Products button on the Suppliers form.

Condition Action Arguments: Setting Comment
Echo Echo On: No Stop screen updating while the macro is running.
IsNull([Supplier ID]) MsgBox Message: Move to the supplier record whose products you want to see, then click the Review Products button again.

Beep: Yes

Type: None

Title: Select a Supplier

If there is no current supplier on the Suppliers form, display a message.
GoToControl Control Name: CompanyName Move focus to the CompanyName control.
... StopMacro Stop the macro.
OpenForm Form Name: Product List

View: Datasheet

Filter Name:

Where Condition: [Supplier ID] = [Forms]![Suppliers]![SupplierID]

Data Mode: Read Only

Window Mode: Normal

Open the Product List form and show the current supplier's products.
MoveSize Right: 0.7799"

Down: 1.8"

Position the Product List form in the lower right of the Suppliers form.