VBA on a button

fanfan2

Registered User.
Local time
Today, 12:44
Joined
Feb 26, 2007
Messages
61
I have a basic question:

I have a button in a form, right click on it --> property --> event -->on click, then on the VBA window, I had:

Private Sub Command7_Click()
MsgBox ("test")
End Sub

then I saved everything and went back to the form, click on the button, nothing happened. Did I miss anything?

thanks in advance.
 
Did you save before you closed the code window? If you look at the On Click event line in the properties sheet for the button does it say [Event Procedure]?

What version of Access? If 2007 or later, code will be disabled if the database is not in a trusted location.
 
Yes I did save the code window, and it was "event procedure". I'm using version 2010. So how can I make sure it's trusted location? It is on my local machine. Thanks.
 
Go to the File tab, then click on Options. In the Options window select Trust Center (should be the last option in the left pane). Click the Trust Center Settings button then select Trusted Locations. From here you can add a new location if you need to. If you do add a new location, you may want to check the option to include sub folders as well.
 

Users who are viewing this thread

Back
Top Bottom