Disable command button when action completed without error

  • Thread starter Thread starter nxqviet
  • Start date Start date
N

nxqviet

Hi,

I want to disable my command button when the action is successfully
carried out. Not just when clicked once.

I used:

Dim stDocName As String

stDocName = "MacroName"
DoCmd.RunMacro stDocName

Me.OtherObject.SetFocus
Me.MyCommandButton.Enabled = False


But if I had conditions in my macro, so that when conditions not match,
it will return a msgbox and stop macro from continuing. However, the
button would still be disabled after first click.

I want the button to be disabled only when the series of action in the
macro is completed. Is it possible? or do I have to use all code
instead of using part macro, part code?


Thanks all

V_
 
I'd suggest using all code.

Macros don't really lend themselves to proper error handling.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top