Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Macros or VBA?

Status
Not open for further replies.

flaviooooo

Programmer
Feb 24, 2003
496
FR
Hi,

I have an old database that needs to be updated. the code needs to be rewritten etc...

Now my question:

The database uses macros wherever it can. But in my opinion, VBA is easier to work with.
What are the advantages of macros against VBA, and vice versa? Which one is better, and why?

Thanks in advance :)
 
Hi

Macros are old technology, probably only there to provide backwards compatibility with earlier versions

Without a doubt VBA is better:

easier to use

allows you more control (eg error trapping etc)

But of course that is only my opinion....

Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
Website needs upgrading, but for now - UK
 
flavioooo,
You should avoid macros at all costs. The one possible exception might've been the autoexec, but newer access versions have alternate ways of replacing that, so even that long-standing exception is gone.
--jsteph
 
Autokeys is the only valid reason for using macros in my opinion.

Oh, and sometimes useful for an *optional* startup routine that is triggered from the command line.

Other than that use VBA. The main reason being macros have no error trapping.

Ed Metcalfe.

Please do not feed the trolls.....
 
Another point to Note:

In an MDE file, your code has been removed the user can't look at or modify it, but the user can look and modify the Macros.

Dalain
 
OK, thanks for all the points guys

I will kick all macros out of the database and I'm glad to know it's the right way to go ;-)
 
Some other reasons to use VBA instead of macros is that 1) you can't error trap macros within code as you can VBA 2) macros run slower than VBA code. The easy part is that I believe most, if not all, macros can be replaced by its Docmd. event. I think there is also a utility that actually converts macros to VBA code, so you may want to look at that option since you have so many.
 
Macros are easier to learn and use, and they can always be converted to VBA once they are working and tested

Use macros if, like me, your VBA is C$%P and then learn from it when you complie them.



Neil Berryman
IT Trainer
neil_berryman@btopenworld.com
 
Yeah, definitely stay away from Macros except, possibly, as a way to learn. But don't let yourself hang out there for too him.

Ed, you can use the command parameter of the command line to make your code do whatever you want on startup.

Jeremy

==
Jeremy Wallace
AlphaBet City Dataworks
Access Databases for Non-Profit Organizations

Please post in the appropriate forum with a descriptive subject; code and SQL, if referenced; and expected results. See thread181-473997 for more pointers.
 
Jeremy,

I never knew that. Ta.

I stand by my AutoKeys argument though. This can't be done in VBA......

Ed Metcalfe.

Please do not feed the trolls.....
 
Ed,

Yeah, tis true. Autokeys is the one thing I use macros for, and it's quite handy. I usually have one to turn off the hour glass and one to turn on warnings and one to set the screen to repaint. Do you have any others that you keep handy in most applications?

Jeremy

==
Jeremy Wallace
AlphaBet City Dataworks
Access Databases for Non-Profit Organizations

Please post in the appropriate forum with a descriptive subject; code and SQL, if referenced; and expected results. See thread181-473997 for more pointers.
 
I occasionally use them for developer tools - standard tasks I have to perform. AutoKeys is the only thing I use in the user environment though.

Ed Metcalfe.

Please do not feed the trolls.....
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top