DColin
asked on
Click event not working
Hi Experts,
I have a simple click event on a form that is not working:
Private Sub btnABC_Click()
MsgBox ("ABC")
End Sub
When I go to the buttons properties On Click [Event Procedure] is shown and if I click on the ellipses it opens the Code page with the cursor on the correct event.
I have a simple click event on a form that is not working:
Private Sub btnABC_Click()
MsgBox ("ABC")
End Sub
When I go to the buttons properties On Click [Event Procedure] is shown and if I click on the ellipses it opens the Code page with the cursor on the correct event.
ASKER
Gustav Brock,
Still does not work.
If I type =MsgBox("ABC") into the On Click property then it works but hot from a coded on click event.
Still does not work.
If I type =MsgBox("ABC") into the On Click property then it works but hot from a coded on click event.
Make a backup of your db first, then run this Decompile procedure (attached)
aaQicPostDecompile.txt
aaQicPostDecompile.txt
ASKER
DatabaseMX,
I did not carry out your instructions, I did the following instead.
I created a completely new Db added a single button to a blank form and added the line
MsgBox ("ABC")
to the on click event and it does not work. If I add the line
=MsgBox ("ABC")
to the On click property of the button it does work.
I do not think any form of DB corruption is my problem.
I did not carry out your instructions, I did the following instead.
I created a completely new Db added a single button to a blank form and added the line
MsgBox ("ABC")
to the on click event and it does not work. If I add the line
=MsgBox ("ABC")
to the On click property of the button it does work.
I do not think any form of DB corruption is my problem.
This is not a web database is it?
Maybe time to run Office repair. This makes no sense
Msgbox "ABC" is to display the message
Msgbox ("ABC",vbyesNo) to get the response
Msgbox ("ABC",vbyesNo) to get the response
ASKER
The Access Form I am trying to create is on a new Office 365 installation. I have never created a form on this computer before.
Is there some master switch that needs to be set for the code to execute?
Is there some master switch that needs to be set for the code to execute?
Can you post the test database that isn't working?
ASKER
PatHartman,
Please find attached.
btnABC On Click event is defined in the code and does not work.
btnABC2 On Click event is defined in it's properties and does work.
Database11.accdb
Please find attached.
btnABC On Click event is defined in the code and does not work.
btnABC2 On Click event is defined in it's properties and does work.
Database11.accdb
Both buttons work for me ... message appears.
Do you then have the Click To Run version .... sounds like you do (I do also on this system in fact).
Open the VBA editor ... Debug>>Compile ... just check to see if it compiles - relative to any possible Missing References.
In fact, Tools>>References ... look for any listed as
**MISSING <SomeReferenceName>
Open the VBA editor ... Debug>>Compile ... just check to see if it compiles - relative to any possible Missing References.
In fact, Tools>>References ... look for any listed as
**MISSING <SomeReferenceName>
ASKER
DatabaseMX,
The Debug>Compile option is greyed out. How do I make it available?
The Debug>Compile option is greyed out. How do I make it available?
It is greyed out when the project is in a compiled state. To activate it, make a change to the code. Adding a blank line is sufficient.
Both buttons also work for me. I'm using O2016 32-bit from O365 on Win10
Both buttons also work for me. I'm using O2016 32-bit from O365 on Win10
ASKER
I added a few blank lines compiled the code and nothing seemed to happen the compile menu option is now greyed out again. Does that mean there were no errors.
Correct ...no errors.
Try running an Office Repair ... this is REALLY strange !
Try running an Office Repair ... this is REALLY strange !
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
OOPS ... so simple yet so easy to miss. Bad on us :-)
ASKER
Found the answer myself but appreciate the help in trying to solve the problem.
/gustav