MoveSize Macro Action

If you have set your document window options to use overlapping windows instead of tabbed documents, you can use the MoveSize action to move or resize the active window. For information on how to set document window options, see the Remarks section.

Setting

The MoveSize action has the following arguments.

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 Builder pane.
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 Office Access 2007 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

To set up an application to use overlapping windows instead of tabbed documents, use the following procedure:

  1. Click the Microsoft Office ButtonButton image, and then click Access Options.
  2. Click Current Database.
  3. In the Application Options section, under Document Window Options, click Overlapping Windows.
  4. Click OK, and then close and reopen the database.

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 a Visual Basic for Applications (VBA) module, use the MoveSize method of the DoCmd object.

Example

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.