macros vs modules in Access 2000

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Is there a benefit to using macros? I'm looking at a db created by someone
else, that has a whole bunch of macros. These macros seem to do things that
could just as easily be written in VBA code.

So, what's their use?

Dave
 
People just starting out in Access may find macros easier to use. You
quickly outgrow them though: it's much easier to create a loop in VBA than
in a macro. And since macros lack error handling, they are not really
suitable for serious applications.

Some cases where macros are useful:
a) A macro named AutoExec runs when the database starts. So you can set off
initialization code with an AutoExec macro that uses the RunCode action to
pass control to VBA where you have error handling.

b) A macro named AutoKeys provides a way to handle special keys
application-wide.

c) In some versions of Access, custom menu/toolbar items would not fire
reliably (or would fire multiple times) if assigned to code, but worked fine
with macros. (Again use RunCode to pass control to VBA.)

d) In Access 2007, macros have been significantly enhanced, so you can use
them even in databases where the VBA code is disabled (for security
reasons.) The enhancements include embedded macros, error handling,
TempVars, and an Arguments column that lets you read what the actions are
actually doing.

Fortunately, it is dead-easy to convert the macros to code. Unfortunately,
the resultant code is little better than the macros, except for the error
handling.
 
Hi Dave

This is a link I found a while ago when someone in our office asked me the
same question.

http://www.mdbmakers.com/forums/archive/index.php?t-7061.html

My main answer to why I have left a (very) few mcros on some DB's is that
the admin staff can go into them and alter them with only a little training.
VBA can look a little strange when you are not used to it and macros are at
least a little more non-expereienced user freindly.
 
Back
Top