I have a form that had two command buttons in the form detail section. Both had VBA code behind them on their Click events. I removed one of the buttons as it is is no longer required. Now controls the form header and detail sections do not recognize their click events. Any ideas or solutions? Michael B.

Was not in design mode. The issue was resolved by recreating the button.

It could be that you were in Design Mode, which would not activate a click event as a consequence. Try de-selecting Design Mode and see if that makes a difference.

Hi Michael,

What I was referring to is the use of the /Decompile switch when opening MS Access.

This switch fully decompiles ALL the vba code and removes the intermediate compilations from the application.

Whether the original issue is resolved or not, I would recommend regular decompiling of the application to keep the vba optimised. File size is also reduced in most operations.

In addition, when modifying/copying forms and they become corrupted, the SaveAsText / LoadFromText functions have also been life savers for me many many times.

(Somewhere in the ether there is a repeat of my prior email. It took 16 hours for that last post to be issued. I hope this one is quicker.)

Regards,
Chas

I did a Debug => Compile and there were no errors.
The issue was resolve by re-creating the button and using a copy of the some code.

ddevans888,

The code was is/was not the issue. For some reason the database gets corrupt when I remove the unwanted button every time I remove it.
This is no longer an issue as I copied the code from the wanted button, deleted and re-created the button and put the code back.

Hi,

The supplying of the code would be useful for us to confirm the absence of coding errors, but have you tried decompiling the application and recompile again? This will usually remove non-logical, behavioural issues.

Regards,
Chas

Once again, can you post the code behind the button so we might be able to see what the problem is?
Dave

Thanks Joe, that is what I had to do — recreate the button.

Thanks Joe. I have already restored from a back up with the button that is not needed.
The required button works. I have tried to make the unwanted button visible = No, but it will not accept the Click event with that configuration either.

Can you post the code of the command button?

Or try adding new buttons pasting the code from the old ones, then remove the non working buttons.

Do you have a backup from before you removed the unneeded button? If so see if the button runs the click event if you just set the button you don’t need to not visible.