Solved: Disabling a command button

Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

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.
 

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.
 

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.
 
Joined
Jul 25, 2004
Messages
5,458
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.
 

Rockn

Thread Starter
Joined
Jul 29, 2001
Messages
21,334
This is in Access and I am not using any AX controls.
 
Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

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 807,865 other people just like you!

Latest posts

Staff online

Top