Hiding Buttons

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

What would be the best way to hide a button during the codes execution.
ie I have a button that when pressed, performs some actions. Before exiting
from the buttons on_click procedure, I want the button to become invisible.
Most things I have tries so far give an error along the lines of..
cannot change X when [button] control has focus.

Thank you in advance
 
The error message tells you what you need to do before you can hide the button.
Move the focus to the most relevant button or control on youir form before
hiding
the one you have just clicked.

SomeOtherButton.SetFocus
SomeControl.SetFocus
 
Obvious!.. its been a long day,
cheers

Dennis said:
The error message tells you what you need to do before you can hide the button.
Move the focus to the most relevant button or control on youir form before
hiding
the one you have just clicked.

SomeOtherButton.SetFocus
SomeControl.SetFocus

Ken said:
What would be the best way to hide a button during the codes execution.
ie I have a button that when pressed, performs some actions. Before exiting
from the buttons on_click procedure, I want the button to become invisible.
Most things I have tries so far give an error along the lines of..
cannot change X when [button] control has focus.

Thank you in advance
 
Access doesn't like it when you try to hide a control that has the focus
(or I presume change the ENABLE property). The trick is to shift the
focus and then change the property. So try

Sub mySub()
Me.someOtherControl.SetFocus
Me.cmdButtonName.Enable = False



I recommend changing the enable property since visually it makes a bit
more sense.
 
Back
Top