1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Solved: Disabling a command button

Discussion in 'Business Applications' started by Rockn, Jan 25, 2007.

Thread Status:
Not open for further replies.
Advertisement
  1. Rockn

    Rockn Thread Starter

    Joined:
    Jul 29, 2001
    Messages:
    21,334
    I want to disable a command button after an event is fired.

    The button fires of a RunSQL event, sets a value in a table to not show the button and then I tried to have it set Me!ControlName.Enabled = False, but it will not let me because the control still has focus. Is there a way to remove the focus and then set the control to disabled? I was thinking of setting the focust to another control and then disabling it.
     
  2. OBP

    OBP

    Joined:
    Mar 8, 2005
    Messages:
    19,895
    Rockn, you should be able to do it as you have outlined by setting the "Focus" to another control.
    If you do not have a "Control" on the same form as the Command Button then I usually use a text box, it can't be set to "Invisible", but it can be set to a very small size.
     
  3. Rockn

    Rockn Thread Starter

    Joined:
    Jul 29, 2001
    Messages:
    21,334
    I set the focus to another control after the button is clicked and it worked like a charm.
     
  4. Zack Barresse

    Zack Barresse

    Joined:
    Jul 25, 2004
    Messages:
    5,452
    You should be able to also take a look at the ActionControl property. If this is a controls toolbox (ActiveX) control, you should be able to also return the focus to the worksheet, enabling you access to disable the control.
     
  5. Rockn

    Rockn Thread Starter

    Joined:
    Jul 29, 2001
    Messages:
    21,334
    This is in Access and I am not using any AX controls.
     
  6. Sponsor

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/538311

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice