get and set form position

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Andrew Hall

    #1

    get and set form position

    Hi all

    Can anyone advise how to get the position of an open form and how to set the
    position of an opening form within the access window.

    I have: MA Access97 (because I do not have the funds to obtain a more recent
    version nor the time to learn the new interface)
    Form1 and form2. Both forms are an identical size because of the length of
    the captions of the controls on the forms.

    Form1 which shows the user a list of check boxes

    Some of the check boxes have further options which are displayed as check
    boxes on form2.

    Code within the form1 check boxes looks to see whether further options exist
    and if they do will open form2

    I want form2 to display distance N away from the top line of form1 so the
    user can see that both forms are open. Thus form2 left will be the same as
    form1 left but form 2 top will be form1 Top - 15mm. I have found references
    to .top and .left but these properties are not available.

    Currently both forms are autocentrered so when form2 is opened it obscures
    form1. This is confusing to the user who thinks form1 has closed.

    Any suggestions gratefully received as my research so far has drawn a blank

    Many thanks

    Andrew Hall


  • storrboy

    #2
    Re: get and set form position

    The actual properties to use are WindowTop, WindowLeft, WindowHeight,
    Window Width.
    Other properties you may need to consider are Form.Detail.Hei ght and
    Form.Width. These are seperate from the window properties and can be
    different. The window size is not always the size of the form.

    To move the form, use the DoCmd.MoveSize method. This allows you to
    position the form relative to the Access window and to resize the form
    if needed.

    Note: The 0,0 (origin) point in Access is the topmost and leftmost
    corner of the Access window BELOW the lowest menubar. The origin
    relative to the actual screen can change depending on how many menus
    are on screen.

    Comment

    • fredg

      #3
      Re: get and set form position

      On Sat, 17 Mar 2007 16:12:07 GMT, Andrew Hall wrote:
      Hi all
      >
      Can anyone advise how to get the position of an open form and how to set the
      position of an opening form within the access window.
      >
      I have: MA Access97 (because I do not have the funds to obtain a more recent
      version nor the time to learn the new interface)
      Form1 and form2. Both forms are an identical size because of the length of
      the captions of the controls on the forms.
      >
      Form1 which shows the user a list of check boxes
      >
      Some of the check boxes have further options which are displayed as check
      boxes on form2.
      >
      Code within the form1 check boxes looks to see whether further options exist
      and if they do will open form2
      >
      I want form2 to display distance N away from the top line of form1 so the
      user can see that both forms are open. Thus form2 left will be the same as
      form1 left but form 2 top will be form1 Top - 15mm. I have found references
      to .top and .left but these properties are not available.
      >
      Currently both forms are autocentrered so when form2 is opened it obscures
      form1. This is confusing to the user who thinks form1 has closed.
      >
      Any suggestions gratefully received as my research so far has drawn a blank
      >
      Many thanks
      >
      Andrew Hall
      1) Do not use the AutoCenter property of either form.

      2) Look up the MoveSize method in VBA help.

      Note: All measurements are in Twips (1440 per inch). You'll have to do
      the math to convert inches to cm.

      Set Forms1 to a specific position in the window (I'm using inches
      measurements). For example, code the Form's Open Event:

      DoCmd.MoveSize 3 *1440, 4 *1440

      3 inches from the left edge of the screen, 4 inches down from the top
      of the screen.

      Set theForm2 position similarly to position it .6 inch below the
      Form1. Code the Form2 Open Event:

      DoCmd.MoveSize 3*1440, 4.6* 1440

      Also 3 inches from the left edge of the screen, but 4.6 inches down
      from the top of the screen.
      Adjust the actual placement as required.

      --
      Fred
      Please respond only to this newsgroup.
      I do not reply to personal e-mail

      Comment

      • Andrew Hall

        #4
        Re: get and set form position

        Thanks for the advise

        A great help

        I now have forms positioned all over the place

        Andrew

        "Andrew Hall" <andrew.hall2@v irgin.netwrote in message
        news:rrUKh.4054 $Lz4.2026@newsf e7-gui.ntli.net...
        Hi all
        >
        Can anyone advise how to get the position of an open form and how to set
        the
        position of an opening form within the access window.
        >
        I have: MA Access97 (because I do not have the funds to obtain a more
        recent
        version nor the time to learn the new interface)
        Form1 and form2. Both forms are an identical size because of the length of
        the captions of the controls on the forms.
        >
        Form1 which shows the user a list of check boxes
        >
        Some of the check boxes have further options which are displayed as check
        boxes on form2.
        >
        Code within the form1 check boxes looks to see whether further options
        exist
        and if they do will open form2
        >
        I want form2 to display distance N away from the top line of form1 so the
        user can see that both forms are open. Thus form2 left will be the same as
        form1 left but form 2 top will be form1 Top - 15mm. I have found
        references
        to .top and .left but these properties are not available.
        >
        Currently both forms are autocentrered so when form2 is opened it obscures
        form1. This is confusing to the user who thinks form1 has closed.
        >
        Any suggestions gratefully received as my research so far has drawn a
        blank
        >
        Many thanks
        >
        Andrew Hall
        >
        >

        Comment

        Working...