Results 1 to 7 of 7
  1. #1
    pt5 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2013
    Posts
    3

    Exclamation Command Button Layering (ZOrder?)

    I am using Access (2010) for a bit of a "different" project for work. I have a form with a picture on it. On top of that picture are a few large command buttons. "Inside" those large buttons are a few smaller command buttons at the very top layer (three layers, if you can picture what I'm portraying). Each button takes me to a different form on click - this I have programmed. However, whenever you click on a command button, Access brings that button "into focus," meaning it covers the buttons that were previously on top of it. For the life of me I cannot figure out how to use VBA to prevent this from happening - I want the original order to be preserved (in AutoCAD it's called "draworder," I believe you may call it "Zorder" on this forum - I have tried the object.Zorder() command but cannot figure out how to make that work, I get some kind of compiling error). Please tell me that there is a way to do this and how.

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,954
    Never heard of ZOrder. It appears to be a Visual Studio method, not available in Access/VBA. Don't think you will get what you want. Control that has focus trumps.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    Dal Jeanis is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2013
    Location
    Dallas TX
    Posts
    1,742

    Pleaes Explain your Technical Requirements

    Okay, to get you the behavior you're looking for, we need to know the reason for the behavior. You have a picture. You have command buttons in particular locations. You are worried about draw order - what's on top.

    It sounds like you're trying to preserve the way it looks, and also trying to make sure that the lower (Z-wise) buttons, when clicked, don't land on top of the upper buttons. Am I close?

    Or are you using the Z order in VBA in order to accomplish some other behavior?

    If we understand the application, then it is much easier for us to offer useful alternatives.

  4. #4
    pt5 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2013
    Posts
    3
    You are correct - that is exactly what I am trying to do. I saw the Zorder command on this website but could not get it to work: http://office.microsoft.com/en-us/ac...080206121.aspx

  5. #5
    Dal Jeanis is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2013
    Location
    Dallas TX
    Posts
    1,742
    Explanation from that page: This method does not affect content or sequence of the controls in the Controls collection.

    Okay, so tell me more specifically what the overall behavior is that you're trying to cause. It seems like there ought to be a way to detect the location of the click on a single image control, so you could do whatever you're trying to achieve with one control instead of several.

    Something like these -
    http://www.freevbcode.com/ShowCode.asp?ID=2890
    http://support.microsoft.com/default.aspx?kbid=210141
    http://www.access-programmers.co.uk/...ad.php?t=64213


    Ah - the bloodied beast! Here it is -

    http://www.utteraccess.com/forum/X-Y...-t1723895.html

    With that, you can grab the cursor position off the image's Mouse-Up event (after a click) and act accordingly.

  6. #6
    pt5 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2013
    Posts
    3
    All of these links seem to be dealing with the x & y coordinates of a control; I need to alter the z coordinate. Lets say that we have three controls on top of one another, with the corners sticking out in different locations. Whichever one you click on, regardless of its position in the stack, will "gain focus" and be moved to the top of the stack permanently. I want to either prevent this from happening or find a way to correct it (put it back in the correct order) after it has happened.

  7. #7
    Dal Jeanis is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2013
    Location
    Dallas TX
    Posts
    1,742
    Sorry, I was telling you how to solve your business need, not your proposed zorder solution, whcih doesn't appear to be supported. As I previously quoted from this page http://office.microsoft.com/en-us/ac...080206121.aspx -

    This method does not affect content or sequence of the controls in the Controls collection.
    Your business need is that, when you click in a particular area of the screen, you want a particular behavior to occur, then when you click in a different area, you want a different behavior. And you want these areas to be concentrated together on the screen, and to appear a certain way visually.

    The solution I proposed was to use a single image control, rather than overlapped controls, and have that single control use the cursor position (from mouseup as in the last link) to determine what state the control was supposed to be in and what it was supposed to do. If you wanted to replace the image based upon which status was active, that could be helpful too.

    I'm sorry I don't have a solution that uses your existing overlapped controls - this proposal offers a way to use the code from those controls inside a control structure (like select case) behind a single image control, to meet your business need.

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

Similar Threads

  1. Command Button Help
    By emailloni in forum Forms
    Replies: 5
    Last Post: 07-30-2012, 09:16 AM
  2. Command Button
    By JayX in forum Access
    Replies: 1
    Last Post: 03-13-2012, 06:35 PM
  3. Button Command
    By JayX in forum Access
    Replies: 2
    Last Post: 12-15-2011, 12:33 PM
  4. command button
    By berni3883 in forum Forms
    Replies: 17
    Last Post: 04-22-2011, 12:04 AM
  5. Replies: 1
    Last Post: 07-27-2010, 02:27 PM

Tags for this Thread

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