MoveAndSizeWindow Macro Action

In Access desktop databases if you have set your document window options to use overlapping windows instead of tabbed documents, you can use the MoveAndSizeWindow macro action to move or resize the active window. For information on how to set document window options, see the Remarks section.

Note: This macro action can't be applied to code windows in the Visual Basic Editor. For information about how to affect code windows, see the WindowState property topic.

Note: Beginning in Access 2010, the MoveSize macro action was renamed to MoveAndSizeWindow.

Note: The MoveAndSizeWindow macro action isn't available in Access web apps.

Setting

The MoveAndSizeWindow macro 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 argument box.

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, 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

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

  1. Click File > 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 MoveAndSizeWindow macro action, you enter the position and size measurements directly. You can also use the mouse to move and size windows.

You can use this macro 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 MoveAndSizeWindow macro 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 actions open 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 MoveAndSizeWindow 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.

MoveAndSizeWindow

Right: 0.7799"

Down: 1.8"

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

Share Facebook Facebook Twitter Twitter Email Email

Was this information helpful?

Great! Any other feedback?

How can we improve it?

Thank you for your feedback!

×