Results 1 to 6 of 6
  1. #1
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    Warrington, Cheshire, England
    Posts
    712
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Positioning Controls (2003)

    I have a form which is displayed to capture up to 3 query/report parameters. One, two or all 3 parameters need to be visible depending on the report option chosen (which is done via an option group).
    Making the controls visible or invisible is working OK but the visual effect can be that the controls 'bounce' around if, say, option 1 is selected and then the user realises they want a different option.

    I would like to position the controls when they are made visible i.e in effect, specify the X, Y coordinates of the newly visible control.
    Is there a way to specifiy the position of a control from within a Visual Basic routine and, if so, how's it done, please?
    Thanks
    Silverback
    Silverback

  2. #2
    Super Moderator WebGenii's Avatar
    Join Date
    Jan 2001
    Location
    Redcliff, Alberta, Canada
    Posts
    4,066
    Thanks
    2
    Thanked 5 Times in 5 Posts

    Re: Positioning Controls (2003)

    you use the .top and left property for the control, distance is measured in twips <post#=672,855>post 672,855</post#>
    [b]Catharine Richardson (WebGenii)
    WebGenii Home Page
    Moderator: Spreadsheets, Other MS Apps, Presentation Apps, Visual Basic for Apps, Windows Mobile

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

    Re: Positioning Controls (2003)

    You can change the position of a control by specifying its Left and Top properties. These measure the distance from the upper left corner of the section in which the control resides. The unit is twips, where 1 inch = 1440 twips. So if you want to position txtLastName 1 inch to the right and 0.5 inch down from the upper left corner of the section, you'd use
    <code>
    With Me.txtLastName
    .Left = 1440
    .Top = 720
    End With</code>

  4. #4
    Super Moderator WebGenii's Avatar
    Join Date
    Jan 2001
    Location
    Redcliff, Alberta, Canada
    Posts
    4,066
    Thanks
    2
    Thanked 5 Times in 5 Posts

    Re: Positioning Controls (2003)

    hah! by keeping my reply extremely short and referencing your previous answer I was JUST barely able to slide my answer in before you.
    [b]Catharine Richardson (WebGenii)
    WebGenii Home Page
    Moderator: Spreadsheets, Other MS Apps, Presentation Apps, Visual Basic for Apps, Windows Mobile

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

    Re: Positioning Controls (2003)

    <img src=/S/blackteeth.gif border=0 alt=blackteeth width=20 height=20>

  6. #6
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    Warrington, Cheshire, England
    Posts
    712
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Positioning Controls (2003)

    Thanks to you and Hans; just what I wanted.
    Many thanks
    Silverback
    Silverback

Posting Permissions

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