Macros vs. VBA

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

Guest

Hi,
I'm just learning code for VB. All my databases in the past used macros.
Do you think it would pay to convert the macros to VB now that I'm beginning
to understand code?
Many of the macros are simple "form.open.maximize" type procedures.
Are VBA procedures more memory efficient, and faster?

Thank you for your time,
Amy
 
Hi Amy,

I would definitely try and work on converting the macros to VBA.

The biggest benefit of using VBA is error trapping. With a macro, if it encounters an error of ANY
kind you get that nasty "Halt" message and everything stops. Basically Access coughs up a hairball
on your keyboard. For trained users this may be fine, but for new Access users they will most likely
not know what to do next. With proper VBA error trapping you can ignore some common (but harmless)
errors like 2501 and/or display a meaningful message for unforeseen errors. You can then have Access
gracefully exit the procedure and move on. In an Access Runtime environment an unforeseen error will
usually crash the application so macros would be definitely something to steer away from.

On a personal note I think it is a bit "easier" to have form and report code contained within
itself. Yes, sometimes you need to run some code in modules, but you have one less place to look for
debugging issues if you do not have to go tracing through a long list of simple macros. You can even
create your own error logging table that will track what exact procedure caused an error. Macros
just do not have this capability.
 
Mr. Conrad, Thank you for taking time to answer my question.

Do you or anyone know if there are any negatives to using the built-in
convertor tool for converting macros to VB?
Or would it be better to write the macro procedures into VB from scratch?

Thanks again,
Amy
 
Hi Amy,

I'm afraid I do not have any personal experience with the macro converter tool as I only use macros
for AutoExec and AutoKey stuff. Perhaps someone with more macro/converter experience will jump in
and help.

My best guess would be that it will work *most* of the time. I imagine that the higher the
complexity of the macro the less likely you will get a perfect conversion. Simple macros like the
one you previously mentioned should probably be easy for the converter.
 
i have had experience. the converter has worked perfectly
each time. but i would recomment doing some from scratch.
this would help in the learning process.
-----Original Message-----
Hi Amy,

I'm afraid I do not have any personal experience with the
macro converter tool as I only use macros
for AutoExec and AutoKey stuff. Perhaps someone with more
macro/converter experience will jump in
and help.

My best guess would be that it will work *most* of the
time. I imagine that the higher the
complexity of the macro the less likely you will get a
perfect conversion. Simple macros like the
one you previously mentioned should probably be easy for the converter.
With a macro, if it encounters an error of
stops. Basically Access coughs up a
but for new Access users they will most
trapping you can ignore some common (but
harmless)
for unforeseen errors. You can then have
Access Runtime environment an unforeseen error
modules, but you have one less place to look
through a long list of simple macros. You can
 
Thanks, I think I'll try it both ways for learning.
The converter would definitely save me time. I had a lot of macros in some
of my past databases.

Amy
 
Back
Top