Full Version: Disable a button or make it disappear
UtterAccess Discussion Forums > Microsoft® Access > Access Forms
moadams2
I have a button on a form that runs a macro which appends data from one table to another, creating new records that are only partially filled out, then a second button is pushed which opens a form that allows the users to fill in the remaining information.

After pushing the button once is there a way to disable it or make it disappear?

I am not very good at coding so have mainly tried to work with macros...however I am willing to try anything.

Thanks for your help!
Doug Steele
If the button has focus, there's no way to make it hide nor disable it. Move focus to some other control, though, and then it's a one-liner in VBA:

Me.NameOfControl.Visible = False (to hide it)

Me.NameOfControl.Enabled = False (to disable it)

(Moving focus to another control is simply Me.NameOfOtherControl.SetFocus)

Edited by: djsteele on Fri Nov 2 15:07:58 EDT 2007.
moadams2
Thanks for the quick response.

Can I do this within the macro code or do I need to make it a module? Can you sort of walk me through it?
Aquadevel
Personally, I never try and hide any buttons or controls in an application mainly because users will
say 'but it was there a minute ago!'. Its better IMHO, just to enable/disable controls on applications based upon
your clients needs and cause the least amout of 'issue's/questions' on why an application works one way one time, &
different another.

Ok, that was just my 2 1/2 cents worth. sad.gif
moadams2
Thanks. That is my preferred method. I was able to get the button to be disabled. I appreciate the help of the forum.
Aquadevel
moadams2,

Glad you have it working the way you want! sad.gif
I hope I didn't imply that Doug's suggestion/method was wrong.

Just disabling is my preferred method. sad.gif
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.