General Question: Macros, Or Event Procedure, which is preferred? (1 Viewer)

Nangasaur

Registered User.
Local time
Today, 07:07
Joined
May 9, 2010
Messages
29
Using Access 2007, Windows 7.

Just looking for general advice and opinions on which is a more efficient and preferred method, programmatically, to run commands and execute functions within forms: Macros, or VBA Event Procedures?

I am clearly getting into the learning curve that there is far more control over what I am trying to do when I use Event Procedures over Macros. But I'm looking for the experienced opinions that know whether either choice is actually advantageous over the other, besides personal control.

Will my database run faster, however miniscule it may be, if I use a macro or event procedure?

Is there less chance of database corruption with either choice?

And most importantly, on a high-security network like we use in the DoD, will using VBA Event Procedures remove the need for users to have to Enable Macros every time they open the database? Obviously I haven't tested this, as I am currently in the process of converting all my Macros to Event Procedures slowly but surely as I learn how to do it, but I would like to know beforehand if it's worth the effort or not, other than just for programming knowledge gained.

Is DoCmd basically the same as running a command from a macro? (Am I showing my lack of VBA knowledge by asking this question?)

And lastly, will drinking heavily (more than I already am while trying to redesign a database for the Army that is clearly antiquated), improve my comprehension of VBA and Access?

Thanks for any advice, answers, and critique.

P.S. - Bob and Coach, Your advice in my very first thread I posted here has greatly pointed me in the right direction toward truly learning what I am doing and how to design a database properly. I hope you'll be pleased by the time I'm finished.
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 04:07
Joined
Aug 30, 2003
Messages
36,127
Most of us use VBA rather than macros. More power, flexibility, etc, and better error handling. 2007 will disable both by default I believe, so no advantage there. The most common solution is to add the database location to Trusted Locations. Another advantage to code is that if you distribute an MDE/ACCDE to users, they can not view your code.

Heavy drinking will not improve your comprehension, but it should have a positive effect on your attitude! :p
 

boblarson

Smeghead
Local time
Today, 04:07
Joined
Jan 12, 2001
Messages
32,059
Another advantage to code is that if you distribute an MDE/ACCDE to users, they can not view your code.
Not really an advantage to that as an MDE/ACCDE also will not let you view macros. :)
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 04:07
Joined
Aug 30, 2003
Messages
36,127
Not really an advantage to that as an MDE/ACCDE also will not let you view macros. :)

I guess I didn't really think that out. It makes sense that you wouldn't be able to get them into design view, just like forms and reports. I was thinking they'd be visible, where code is not. As you say, it really wouldn't matter since you wouldn't be able to view the actions. My excuse is that I never use macros. :eek:
 

Nangasaur

Registered User.
Local time
Today, 07:07
Joined
May 9, 2010
Messages
29
Haven't tried that one but it just might work. :D
There's two kinds of folks in my line of work in the Army: those that drink to improve our attitude, and those that get fired from our job.

With that being said, I wish I could simply move my project to a trusted location and have that be the solution, but unfortunately every time I make an update, change some design, or we move to a different site, it would take weeks or months to get my project working for everyone again. It's half the reason why nobody has taken the time and effort to design a true database for what we need, and have just resorted to a simple program that has no use to anyone except the individual using it and is not shareable by entire brigades (which is my end goal).

Future missions are going to require multi-site database coordination, rather than our current mission model that has each shop working only at a single site.

Anyways, it's not a terribly bad hassle for everyone to have to enable macros every time they access the DB from a DoD computer, but I don't want them fearing they are possibly doing something bad, and later blame me or my database for their own ineptitude.
 
Last edited:

Users who are viewing this thread

Top Bottom