Results 1 to 3 of 3
  1. #1
    2 Star Lounger
    Join Date
    Feb 2002
    Posts
    155
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Placing forms at a specific screen location (A2K - SR1)

    My question is more cosmetic in nature. How do we place our form to be opened at a specific screen each time? I find no mention of it in the help file.

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Placing forms at a specific screen location (A2K - SR1)

    (1) If you set the AutoCenter property of a form to No, the form will be opened at the position it had when last saved. If you set it to Yes, the form will be centered (more or less) in the Access application window

    (2) You can use the MoveSize method of the DoCmd object to set the position of the active window explicitly. Example:

    DoCmd.OpenForm FormName:="frmMyForm"
    DoCmd.MoveSize Right:=2880, Down:=1440

    For ordinary forms (Popup = No), the Right and Down values are measured from the top left corner of the client area of the Access window (immediately below the toolbars).
    For popup forms (Popup = Yes), the Right and Down values are measured form the top left corner of the screen.

    The arguments to MoveSize are in twips. There are 1440 twips in one inch, and 20 twips in one point. So in the example, the form will be positioned 2 inches to the right and 1 inch down from the top left corner.

    Notes:

    (a) This won't work if you open the form with the WindowMode set to acDialog:

    DoCmd.OpenForm FormName:="frmMyForm", WindowMode:=acDialog

    In that case, the MoveSize instruction will only be executed *after* the form has been closed and applied to whatever window has the focus then.

    ([img]/forums/images/smilies/cool.gif[/img] Take different screen resolutions into consideration. Developers often have larger resolution screens than end users. You don't want to position a form entirely or partly offscreen.

  3. #3
    Autumn
    Guest

    Re: Placing forms at a specific screen location (A2K - SR1)

    Thanks HansV. Your reply is very informative and helpful. The form placement on screen routine works but rather erratically, however. Thanks once again.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •