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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

What's your opinions on Macros? 1

Status
Not open for further replies.

Crowley16

Technical User
Jan 21, 2004
6,931
GB
Recently I've come across this database, which frankly is quite critical, and used constantly, but have some rather serious design flaws, and one of them was there is not one single line of vba in the entire database.

Everything was done with macros, hundreds of them, all over the place...

I've never used a macro myself, so can someone point out advantages of using macros? Apart from not having to code it yourself...

--------------------
Procrastinate Now!
 
It is only a few days before RoyVidar has posted an FAQ. might be interesting to some of you.
Extract information from macros
faq705-5796
Posted: Apr 6, 2005 (Edited Apr 10, 2005)

________________________________________
Zameer Abdulla
Visit Me
The best thing to spend on your child is your time.
 
I love using macros because they are very easy to duplicate and modify where needed. They are very easy to follow the logic through. I also use VB when macros will not suffice. I find that a combination of the two seems to work the best for me. I have even called macros from inside VB code when needed.

From everything I have read, there is no performance advantages between the two.
 
As per my understanding Macros are slower than VBA. and the worst thing is lack of error handling in macros.

________________________________________
Zameer Abdulla
Visit Me
The best thing to spend on your child is your time.
 
I have read directly in Microsoft Press books that macros are not slower becasue they are ran as VBA code.
 
RoyVidar made an interesting comment on another thread yesterday which is of equal relevance here.

To save you trawling through the whole of the other thread I'll append his pertanent comment here

RoyVidar said:
Most of us try to encourage VBA vs Macros, for lots of reasons, here's a quote from Access Developers Handbook, Sybex
"
* can't recover from errors
* can't easily be used for looping
* are difficult to debug
* can't be used to step through recordsets
* can't be used in transaction processing
* can't pass parameters
* can't be used to call DLLs
* can be halted by users with Ctrl+Break (and this can never be turned off)



Still want to use macros ?





G LS
spsinkNOJUNK@yahoo.co.uk
Remove the NOJUNK to use.
 
thought as much, I won't even bother to look them up...

I'm just glad that I'm not the one that'll need to upsize that database...

although it might get droped on me in a few months...
*shudders at the thought*

--------------------
Procrastinate Now!
 
At times Microsoft's claim proved wrong. They claim Access can have 255 concurrent users. But I don't think more 100 will.....

________________________________________
Zameer Abdulla
Visit Me
The best thing to spend on your child is your time.
 
There is absolutely no reason to not use a combination of both in your applications. There are advantages to using VBA in certain situations and there are advantages to using macros in others.

I use what fits the current development needs.

Unfortunately, far too many programmers make things un-necessarily difficult or confusing for no real reason. The rule of thumb I go by is the prospective of the end user. If it completes the tasks they need correctly, and they find it easy to use than that is what matters.

Some of the most brilliant programmers I have ever worked with make some of their applications so confusing that the end user just can't use them. And if another programmer ever has to work through the logic to make modifications they are in for a very long difficult task.

Macros work very nicely in many situations and they are much easier to follow the logic used when modifying a system; however there are many situations where VBA does a better job. I just feel there is no reason to complicate the application because of some misguided assumptions that macros are inherently poorer programming. In many cases they are as functional, if not even more so.

Bottom line... my opinion is to use what fits the current requirement, weather it be VBA or macros.

Ok, off my soap box now… ?
 
The point of using a Macro is you don't have to learn a programming language. In particular you don't have to learn an object model. Properties and methods can be picked from drop-downs. Unfortunately with Access you either use Macros which are severely limited or you jump to VBA which excessively detailed; although infinitely powerful. It's a great shame (like some other aspects of Access) they couldn't come up with a happy medium..

 
My turn on the soap box...

I think the the first paragraph in the faq referenced by ZmrAbdulla, pretty much sums up my opinion on macros. The missing part of the quote from the other thread, I think gives a fair description of the the view of professional Access developers.

"The bottom line is that you should program using VBA code for all your application development, except when you only need to create a quick-and-dirty prototype or you wish to create a simple application that only you will use."

(for those who doesn't know, Access <version> Developers Handbook, by Getz, Litwin and Gilbert, is often quoted as one of the best, if not the best, reference for developing applications with Access)

I think one needs to realize that Access is created to both make it possible for grandma to create her recepy database, and for professionals to create professional applications. So of course there are features and wizards designed to accomodate all the different levels of users/professionals using Access.

There are two features of Access, that in my opinion, are intended for grandma, and have no place in professional development. Table level lookups and macros (with the possible exception of AutoExec/AutoKeys).

I alway use seatbelts when driving my car, and I always have proper errorhandling in my apps - the latter is simply not possible with macros.

The following discussions relate somewhat to the topic, thread705-882255, thread1256-1022013.

Roy-Vidar
 
MACRO = Hiss, Boo nad other less mentionable 'adjectives'.

My opinion (obviously) but not developed or engineered by me. I have yet to meet a 'professional' programmer using MS. Access who uses macros. They MAY tolerate them while converting some one else's app, but generally attack this aspect fairly quickly. The reasons cited above are more than real and they represent -even individually- sufficient reason to remove / replace them. A few additional 'rationales' may also encourage the less willing:

MS provides a reasonably easy to use conversion tool, which can be set to add the error handling (albeit in a some what crude and dogmatic manner), so actually if you can generate the MACRO, you CAN also generate the VB Code.

MS has publically stated that the capability to generate and use MACROs is maintained only for backward comaptability. This is a clear signal from on high to cease and desist. The ON HIGH have been known to arbitrarily revoke the backward compatability with little notice.





MichaelRed


 
MichaelRed said:
The ON HIGH have been known to arbitrarily revoke the backward compatability with little notice.

Windoz XP for example !


You have been warned folks.




G LS
spsinkNOJUNK@yahoo.co.uk
Remove the NOJUNK to use.
 
I only use macros is two scenarios:

1. To create an AutoKeys macro (I don't believe there is any way of doing this through VBA). I use this to disable certain keyboard shortcuts and create some of my own.

2. To create an AutoStart macro (note: not AutoExec) which is optionally run on startup from the command line. This allows me to create an optional startup routine which is not run if a developer logs in. The only thing this macro will do is open the startup form.

Ed Metcalfe.

Please do not feed the trolls.....
 
I agree with RandyMyers ther is a balance of using macro and VB codeI find it good for Tool Bars, easy to add (or Remove) items. Or a quick way of running applications etc.


Never give up never give in.

There are no short cuts to anything worth doing :)
 
I also agree with the majority of the group.
Only use Macros as a last resort.

I find that if you want to use something like the 'F1' or 'F2' key to pull up your own help or lookup form, you need a Macro (in AutoKey) to intercept the code, otherwise, there is no need or reason to ever use a Macro.

I almost remember, some where back between Access 97 and Access 2000. that Microsoft stated Macros were no longer a supported feature, but would be left in the language for upward compatibility. So, my guess is someday, Macros will(might) not even exist in Access.

Enjoy,
Hap...

Access Developer [pc] Access based Add-on Solutions
Access Consultants forum
 
Apart from Autoexec and Autokey. It is good for running applications. I have online documentation in word. It also can run other macros. Macro can run commands, run code. Can be use to output, open report with where conditions, add menu items. I know this can be done with VB but it a quick way of getting things to work.


Never give up never give in.

There are no short cuts to anything worth doing :)
 
assets:
There are no short cuts to anything worth doing

Warren Buffet:
I never look for 7 foot hurdles to jump. I always look for 1 foot hurdles I can step over


So which one is the World's Richest Person?

 
I second what RandyMyers said about macros. The way I see it, there are 3 occasions when macros are fine to use. 1) When you are developing an app and want a quick prototype. In the end though, you plan to convert the macro to code, which is much more robust. 2) The end-user doesn't expect something fancy because he's in more of a hurry to get the data than he is to get a fancy interface. Maybe in this case, you can create a startup form that instructs the user to run the macro. 3) You are a beginning developer and don't understand VBA well-enough. I shall be eternally grateful to Microsoft for providing Access with enough "platform layers" (entry level, beginners, advanced, champion - these are my words) so that even a one-time novice like myself could create a useful database. I say to the novice, don't be afraid of macros. They don't bite. Just be aware there is more out there to seek.
 
Crowley16,
As I recall Access "92" did not support VB. When Access was first released macros were the only way to accomplish things. I converted most of my Macros to VB but still have 8 in my DB. It would be a daunting task to convert "hundreds" but you can;
On the "File menu"
SaveAs/Export
Save as Visual Basic Module
Jim
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top