Results 1 to 6 of 6
  1. #1
    Tegglet is offline Novice
    Windows 10 Access 2013 64bit
    Join Date
    Sep 2024
    Posts
    12

    Move a form control to the back upon creation with vba


    I have created two superimposed controls and wish to explicitly set which one is on top using VBA code. Is this possible? The visible property is set to True or False according to the result of an "If" statement.

    I can find nothing on the web which makes me wonder if this can only be done from the "Arrange Tab" > "Sizing and Ordering" items on the ribbon.

  2. #2
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,556
    Have you looked at the Position options?

    That would then give a clue as what to search for?

    One link found. https://stackoverflow.com/questions/...r-send-to-back

    Plus you just hide/show each as required.
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  3. #3
    Micron is offline Very Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,423
    AFAIC the question relates to z order for controls, and I think there is no such thing in Access vba I but could be wrong.
    What's wrong with hiding one or the other? Doesn't that make it appear that there is only one? Perhaps you only need one anyway, especially if the are the same type. Its properties and function could be altered based on whatever your If test is all about.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  4. #4
    Tegglet is offline Novice
    Windows 10 Access 2013 64bit
    Join Date
    Sep 2024
    Posts
    12
    Quote Originally Posted by Welshgasman View Post
    Have you looked at the Position options?

    That would then give a clue as what to search for?

    One link found. https://stackoverflow.com/questions/...r-send-to-back

    Plus you just hide/show each as required.
    I was looking under the "Sizing and Ordering" options (see first post) and searching accordingly but could find nothing. The code from the link wouldn't work either at creation time or when the form was opened.

    Micron
    AFAIC the question relates to z order for controls, and I think there is no such thing in Access vba I but could be wrong.
    What's wrong with hiding one or the other? Doesn't that make it appear that there is only one? Perhaps you only need one anyway, especially if the are the same type. Its properties and function could be altered based on whatever your If test is all about.
    This was a belt and braces thing, I have created the combo box before the list box which puts them in the order I want. I just wanted to be sure that future changes didn't upset the apple cart.
    I am using the visible property to display/hide it as required. This works fine with the code as it is, I was just trying to make it a bit more robust.


    Thank you both for your prompt responses.

  5. #5
    Tegglet is offline Novice
    Windows 10 Access 2013 64bit
    Join Date
    Sep 2024
    Posts
    12
    QUOTE=Welshgasman;527806]Have you looked at the Position options?


    That would then give a clue as what to search for?


    One link found. https://stackoverflow.com/questions/...r-send-to-back


    Plus you just hide/show each as required.[/QUOTE]


    I was looking under the "Sizing and Ordering" options (see first post) and searching accordingly but could find nothing. The code from the link wouldn't work either at creation time or when the form was opened.


    Micron AFAIC the question relates to z order for controls, and I think there is no such thing in Access vba I but could be wrong.
    What's wrong with hiding one or the other? Doesn't that make it appear that there is only one? Perhaps you only need one anyway, especially if the are the same type. Its properties and function could be altered based on whatever your If test is all about.

    This was a belt and braces thing, I have created the combo box before the list box which puts them in the order I want. I just wanted to be sure that future changes didn't upset the apple cart.
    I am using the visible property to display/hide it as required. This works fine with the code as it is, I was just trying to make it a bit more robust.



    Thank you both for your prompt responses

  6. #6
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    Posts 4 and 5 were moderated, I'm posting to trigger email notifications.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 3
    Last Post: 05-30-2014, 12:34 AM
  2. Replies: 3
    Last Post: 08-15-2013, 10:43 AM
  3. Replies: 8
    Last Post: 07-18-2013, 01:52 PM
  4. Replies: 19
    Last Post: 12-21-2012, 06:57 AM
  5. Replies: 4
    Last Post: 05-21-2012, 08:21 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums