Results 1 to 4 of 4
  1. #1
    5 Star Lounger
    Join Date
    Jul 2001
    Location
    NJ, USA
    Posts
    617
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Repositioning with VBA (AccessVB)

    I have been trying without success to figure out how to reposition a form after its size has been changed.

    The form starts out about 3.5 inches wide and expands to 7 inches so I could include include instructions. Hans helped me with that earlier.

    But I need to center the form after it has been opened and then recenter once it is collapsed. AutoCenter is set to Yes.
    Any and all help would be appreciated.

    Thanks Fay

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

    Re: Repositioning with VBA (AccessVB)

    DoCmd.MoveSize can be used to move (and resize) the active form.

    DoCmd.MoveSize 1440, 2880 will position the active form 1 inch (1440 twips) from the left edge of the client area of the Access window, and 2 inches (2880 twips) from the top edge of the client area of the Access window.

    You'll have to work out how far to move the window.

    Note: if the user can move the window, it may not be centered any more when the user expands it. It might be disconcerting if it suddenly moves back to the center.

  3. #3
    5 Star Lounger
    Join Date
    Jul 2001
    Location
    NJ, USA
    Posts
    617
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Repositioning with VBA (AccessVB)

    Thanks Hans. Once again you hit the nail on the head. Some day there will be an easier way to figure out how to find the appropriate information in a book.

    Fay

  4. #4
    Silver Lounger
    Join Date
    Jun 2002
    Location
    Cheadle, Staffordshire
    Posts
    2,177
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Repositioning with VBA (AccessVB)

    Fay
    Check out post 205121 in this forum.
    There is a brilliant utility which is an absolute must if you are designing forms to pop-up over other forms.
    I created an "Autokey" macro to call the form "frmMoveSize" whenever I need to check a forms screen position.
    The updated utility is far better than the original, having Twips, cm,inches etc.

    Credit to HansV

Posting Permissions

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