Programmatically put controls to foreground/background RRS feed

  • Question

  • In design view there's a functionality to put selected object(s) on a form to the foreground/background. It has to do with the order of layers, how objects (controls) are stacked. When applied, the selected object(s) are placed before or behind all other objects. These two buttons are on the tab ARRANGE (I think so, I'm working with the Dutch version, so I'm not sure). Caption of the buttons will be To foreground, To background.

    I've searched for properties and methods to do this job programmatically (also in design view), but can't find out which property or method I have to use. Is there someone how can advise me?

    Many thanks.

    Peter van Loosbroek

    Monday, October 5, 2015 2:50 PM


All replies

  • I don't think you can change the stacking order unless the form is in design view. What I do is hide or unhide controls that are stacked so the one I want shows.

    Bill Mosca

    Monday, October 5, 2015 2:59 PM
  • Hi Peter. Have you tried using the RunCommand objects?

    DoCmd.RunCommand acCmdBringToFront

    DoCmd.RunCommand acCmdSendToBack

    Hope that helps...

    Monday, October 5, 2015 3:01 PM
  • Hi DB Guy,

    This works! Thanks a lot!

    Greets Peter

    Monday, October 5, 2015 3:13 PM
  • Hi DB Guy,

    This works! Thanks a lot!

    Greets Peter

    Hi Peter,

    You're welcome! Bill and I were happy to assist. Good luck with your project.

    Monday, October 5, 2015 3:48 PM