Previous 97/XP User, Can't Figure Out How to Enter VBA on 2010 (1 Viewer)

larrytxeast

New member
Local time
Today, 16:20
Joined
Sep 5, 2015
Messages
7
I previously did a lot of designing Access databases using 97 and XP, this was some 10 years ago, although I did make a brief "comeback" of sorts during a job I had in 2010, I used the 2007 or 2010 version (I believe the 2007). It was a HUGE deal having to figure out that ribbon and everything.

Now, after a long absence, I've trying again, as a friend is having issue designing a database in their 2013 version. I have a 2010 version on this computer so I'm trying at it again.

This is my first post, so for a brief rundown on who I am and my skill level and background etc, go to my post in the "introduction" forms here (it won't let me link, but I will say it's "Tiny URL" and then qesxg8l or just browse there yourself).

Previously, if I were designing a button on a form and wanted this button to close the form, I'd right click on the button and select "build event" then something would pop up (I forget which) but when I selected it I would then be in the VBA window, at which point I'd find the code for the button (named "cmdExit" or such) and simply type in "DoCmd.Close."

Instead, when I do that in Access 2010, a large text box appears and I see a drop-down that says "Add New Action" and there is no way I can see to where I can just type out "DoCmd.Close" and get on with my life. I can't see the sections where it shows "cmdExit" or anything, I see something like "Close Window" on one line then "Object Type" on another line etc. Honestly, I have no earthly idea what in the world I am looking at. It's like I'm in the twilight zone or something.

Help, please, thank you.

UPDATE: I have figured out how to type in the code, from the drop-down on the property sheet I selected "Event Procedure" vs whatever was there before (I forget), and now I'm able to type it in. HOWEVER, when I have the form open and click the button, the code doesn't run. Is there some security setting I need to change, something that's disabling VBA or such?
 
Last edited:

CJ_London

Super Moderator
Staff member
Local time
Today, 22:20
Joined
Feb 19, 2013
Messages
16,616
Instead, when I do that in Access 2010, a large text box appears and I see a drop-down that says "Add New Action" and there is no way I can see to where I can just type out "DoCmd.Close" and get on with my life.
To avoid the macros, go to file>options>object designers and tick the always use event procedures in the for/report design section.

Or as I presume you have now discovered, select 'code builder' after you have clicked on the three dot carat.

HOWEVER, when I have the form open and click the button, the code doesn't run.
Sounds like you haven't actually inserted the code
 

zpy2

Registered User.
Local time
Today, 14:20
Joined
Jun 14, 2014
Messages
26
Also can set click property of the button as [event], then press ALT F11 to code.
 

larrytxeast

New member
Local time
Today, 16:20
Joined
Sep 5, 2015
Messages
7
Thanks, I have managed to figure that out.

I am still getting stuck on some extremely basic things, though, which I'll post about.
 

Users who are viewing this thread

Top Bottom