I made this statement in a thread earlier ...
"Macros are becoming obsolete as they are very difficult to maintain"
JConsulting suggested I create a debate on the subject, so I am :)
I made this statement because when designing bespoke applications (which I do) the general feedback I am getting from IT departments is not to use macros as they make life difficult in terms of long term maintenance and future upkeep of the database.
I never use macros in applications and code everything using vba. This allows me to comment all actions to allow for future maintenance and development.
Discussion please.
Mary
28 3721
I never did learn how to use macros but i feel that using both macros and vba would lead to more confusion than anything.
I never did learn how to use macros but i feel that using both macros and vba would lead to more confusion than anything.
Hi Mary and Jeff,
Imho Macros will always play second fiddle to VBA, but will have their own little niche for 3 main reasons:
1. the ability to use the macro recorder in excel and word to generate working VBA code that facilitates the integration and use of automation objects.
2. Newbies seem to get comfortable with and can create macros much quicker and easier than VBA......and there will always be newbies.
3. There are some things that are easier and better done with Macros than VBA.....for example...the autoexec macro and task scheduling.......
My 2 cents.
PDB
Hi Everyone,
I've recently been hired to work on a database by a client that uses Access 2007. Now...we've already all heard of the stories about that...and probably merits another discussion later on, however...
The database that was handed to me was created from one of M$'s Templates. Auto-generating kind of thing that when it's all said and done, presents you with a semi-usable database. One thing they didn't forget to leave behind with this new version of Access is the stupid Switchboard!! Well, guess what drives this, just as it always has...Macros. Extensive ones. Command buttons...all macro driven.
I've never been a big fan of Macros. If I ever did use them, I would inevitably convert it to code.
I've made extensive toolbars though, using macros to Run code, simply because of the drag and drop option when you're customizing a menu bar.
And as PDB states, I think every single database I've built since I started has an Autoexec Macro in it...just to kick things off.
So at least for now...Microsoft still loves their macros, new users do too, although in time I think they turn to the dark side like all of us, and become code warriors.
I suppose to end my soap box rant here, I can say that I use macros when I'm forced to. They haven't changed in the last 4 versions of access...and I doubt that M$ will do away with them any time soon. They would have to find a new way to auto-generate too much code.
Thanks all for listening.
J
Granted there are a couple of things like AutoExec that Macros are good for although I'm inclined to use spash screens.
But as you point out yourself Jeff. Maintaining Macros is a bit of a nightmare. I think I'll stick to my coding. :)
After a discussion with KUB I'm moving this back to the forum. We can continue this there.
Three points about macros:
(1) They allow no Error Trapping. (2) They are limited in what they can do.
(3) They make debuggging very difficult. If something's amiss, you can't simply open the VBA and investigate, you have to leave your form, goto the objects dialog box, goto Macros then open the offending macro! Too much like real work!
NeoPa 32,554
Expert Mod 16PB
M$ will always have reasons for doing things in a way whose only benefit is to rope in new customers. This is not a bad thing in itself, but it can (usually does) lead to worse practices.
Macro's are a case in point. Here I would differentiate between Access macros and those, like Excel, where the recorded macro is stored as VBA. The latter is actually a really neat facility (IMHO) and I used it (and still do sometimes actually) to learn more about how to do certain things.
Access macros are different, and I see no positives about them at all. AutoExec macros can quite easily be replaced by a form, which doesn't even need to be visible if you don't want it to. VBA code is far more flexible (it is after all possible to execute any macro action from there) and is far better suited to documentation and good coding practices.
I suspect that we will still need to support and answer questions on macros for some time to come, but I see no reason why we shouldn't encourage users (vigorously) to attempt the VBA approach wherever possible.
I agree, Ade, there is no comparing macros in Access and those in Word and Excel; two different creatures! And, of course, Micro$oft uses macros as a come on to convince people with no real training/talent that they, too, can be "programmers!" The really sad thing is that most college-level courses in Access seldom go beyond macros! People take an Access 101 course, learn about macros, then get a job and tell their bosses "sure, I know Access!" Then when they get handed an assignment to develop a database they don't have a clue! They then show up here (and on other forums) and rather than ask a question like "How do I retrieve a particular record with a combobox" they say "I need to develop a customer database. How do I do that?"
Sorry! ;0(> Too much coffee!
I would have to agree that macros are becoming obsolete. So far in my two years of college in a programming course, there has been a heavy emphasis on databases and database programming. Access was used as a learning tool for databases. The main focus was on normalization and writing sql. We never learned macros at all. Everything was always done through code and thats how I continue to do things. I haven't yet run into a scenario where I need to use macros. So maybe that's a sign that macros are on the way out or it could just be my college's choice not to teach them. Anyways just thought I'd share some info from the perspective of someone just entering the field.
Jared
I agree with everyone that VBA is much more powerful than macros but I don't think they are becoming obsolete. My last 2 development jobs (both co-op placements) have used a lot of macro programs. I agree they're a b*tch to maintain but the business process for developing an application in terms of binder documentation and management sign-offs and all of those sorts of things can be complicated. I'm a big fan of a quick and painless macro for these types of jobs.
Macros are also good for the user. Generally speaking there is less training that needs to be done with a macro versus a full-out, gui application.
I'm not saying I'm a fan of macros and by no means should businesses convert all their coding projects to macros. However, there will always be a place for macros. Another example, just today I was asked to go through a sorted Excel file and assign each item a unique ID (10, 20, 30, ...). MACRO TIME! Quick fix and 5 minutes later, long weekend time!
Macros will never be obsolete. They do have their place in the coding world. But there will always be something more powerful out there. It's like asking is ASP or Java better. The debate will always go on. It depends on what you're doing and who you're doing it for.
This post as gone long enough *clicks submit*
- LB
it could just be my college's choice not to teach them.
Or you were lucky enough to have excellent instructors!
This is also very true. I have to admit my program has some of the best teaching staff there is. I don't know too many teachers that will answer urgent emails at 11:30pm because a program for a team project has blown up. But I'm glad to say I've got them!
Also I think it's unfortunately the General Education courses or the Business Administration Assistant etc. courses that tend to be the "Learn everything MS Office has to offer" and that lead to those people you described earlier that think they can program because they made a macro once.
Just to make one distinction. My opinion on macros is confined to Access. I agree they have their place in Excel and Word.
Just because it's convenient for the inexperienced user doesn't mean macros should stay as part of Access. MS already put too much focus on the untrained user in Access and not enough on the developer. Thats why Access keeps getting such a bad reputation.
I agree with all the things you've said here about why NOT using macros. But is there another way to assign some action to custom menu buttons ?
I use macros for menus and for Autoexec only (I think that autoexec is still more elegant than creating dummy startup form).
NeoPa 32,554
Expert Mod 16PB
I agree with everyone that VBA is much more powerful than macros but I don't think they are becoming obsolete. My last 2 development jobs (both co-op placements) have used a lot of macro programs. I agree they're a b*tch to maintain but the business process for developing an application in terms of binder documentation and management sign-offs and all of those sorts of things can be complicated. I'm a big fan of a quick and painless macro for these types of jobs.
Macros are also good for the user. Generally speaking there is less training that needs to be done with a macro versus a full-out, gui application.
I'm not saying I'm a fan of macros and by no means should businesses convert all their coding projects to macros. However, there will always be a place for macros. Another example, just today I was asked to go through a sorted Excel file and assign each item a unique ID (10, 20, 30, ...). MACRO TIME! Quick fix and 5 minutes later, long weekend time!
Macros will never be obsolete. They do have their place in the coding world. But there will always be something more powerful out there. It's like asking is ASP or Java better. The debate will always go on. It depends on what you're doing and who you're doing it for.
This post as gone long enough *clicks submit*
- LB
While I respect your right to hold that opinion, I have to say I can't find anything to support it from my experience.
Obviously I have no argument with with Excel macros (See posts #8 & #14), but Access macros are another matter. You say that they are quick and easy to implement, but doing things the 'wrong' way is still wrong, even if it's easier. The reason it's discouraged is because the overall cost is increased. It may get you home early for the weekend, but someone will be staying later because it's a situation that's harder to maintain. I see nothing in your post that recommends me (read responsible person) to use Access macros.
Macros in Access were developed before VBA was implemented within Access. They have been left in because of compatibility. Apart from the obvious drawbacks, I have yet to hear a cogent argument that they have any benefits whatsoever. The idea that the AutoExec macro is more elegant is the closest I've heard so far, though personally I find the reverse to be true.
BTW LB, this is my personal opinion, and in no way reflects the opinions of the management per se. Furthermore, the fact that I disagree with you on this matter in no way effects my opinion of you as a helpful contributor to these forums.
Greetings again all,
I may have missed it after reading through all these threads, but one other very important arguement FOR macros is the Batch Shell method of executing an event or procedure using a Scheduler. The /X Macroname command line arguement is one that I use to perform nightly jobs.
Again, I am not necessarily an advocate of the Macro as a consistent tool to be used in place of proper coding with error handling. I'm a VBA freak if the truth be known and would choose a code window over a Macro Grid any day of the week.
I could find a way to live without them...and would love to. But to raise the arguement again about how they are being phased out....I don't see how that is a true statement given M$'s continuing extensive and almost exhaustive implementation of them...even in their latest and greatest Access Flagship application.
J
NeoPa 32,554
Expert Mod 16PB
Hi J.
At last a valid reason for using Access macros (Not that I'd phase them out even now - there are too many installed projects that use them).
If I needed to use that concept I'd want to research alternatives first, but as things stand, it's a good reason to use them.
-Adrian.
I have been reading this thread and have become quite concerned. As a novice at Access I use quite a lot of macros especially for menu commands. Would it be OK to convert the macros to code using Tools/Macro/Convert Macro to Visual Basic or would this still leave problems.
Thanks for any advice.
I have been reading this thread and have become quite concerned. As a novice at Access I use quite a lot of macros especially for menu commands. Would it be OK to convert the macros to code using Tools/Macro/Convert Macro to Visual Basic or would this still leave problems.
Thanks for any advice.
You can convert them if you wish. If you run into any problems, start a thead and we will do what we can to help.
If you are worried about macros disappearing I wouldn't be concerned. Regardless of this discussion I doubt MS have any intention of doing away with macros.
NeoPa 32,554
Expert Mod 16PB
I would recommend converting, although the code will be something along the lines of : - Execute macro action 1
-
Execute macro action 2
-
etc.
Hardly a tutorial for coding properly, but an introduction to the idea nevertheless.
If you're building up your skills, I don't know how much use macro development will be - either employment wise or practically.
MS Access has Macros? j/k Seriously I am quite sure that Macro's will be around for a long time simply because MS Access was never designed for major Business use, mostly small businesses and personal use. The people in these positions using MS Access are not always as well versed with VBA and most don't even know what VBA is or even looks like.
My first app started with Macros but after I designed about 12 or so macros, I realized that VBA was the way to go and I never looked back. O.K. maybe once or twice but it was only until I found a better way.
Command line switchs can call a function from your database, my MS Access is currenbtly tied up running a report however I have used this tactic before so I know it has worked check out this thread. Simple command line prompt to call MS Access Module?
I utilize a Main Menu with most all of my apps so an on open or on load event tends to work fine for me. I always add in a snippet checking to see if the db has been opened by a user or if it is automation just in case I utilize an outside procedure to call a function or a request to open the db for automation purposes. This can prevent lots of my Main Menu unnecesary code from running on the startup.
if app.UserControl = false then exit or do whatever.
I haven't utilized custom menu's in a while yet I am quite sure that calling a Function from there is also no problem.
O.K. I thought there was a way I guess I was mistaken it has been a long time since I have used any command line options. I find myself using VBS for so much of what I need to do when I don't physically need to go into MS Access.
O.K. I thought there was a way I guess I was mistaken it has been a long time since I have used any command line options. I find myself using VBS for so much of what I need to do when I don't physically need to go into MS Access.
If you mean calling a funtion in a custom menu then you can.
Put something like this in the OnAction property of the custom menu item.
=functionName()
NeoPa 32,554
Expert Mod 16PB
Weird! Forget the white knight.
This is a case of the DRAGON coming to the rescue :D
While I respect your right to hold that opinion, I have to say I can't find anything to support it from my experience.
Obviously I have no argument with with Excel macros (See posts #8 & #14), but Access macros are another matter. You say that they are quick and easy to implement, but doing things the 'wrong' way is still wrong, even if it's easier. The reason it's discouraged is because the overall cost is increased. It may get you home early for the weekend, but someone will be staying later because it's a situation that's harder to maintain. I see nothing in your post that recommends me (read responsible person) to use Access macros.
Macros in Access were developed before VBA was implemented within Access. They have been left in because of compatibility. Apart from the obvious drawbacks, I have yet to hear a cogent argument that they have any benefits whatsoever. The idea that the AutoExec macro is more elegant is the closest I've heard so far, though personally I find the reverse to be true.
BTW LB, this is my personal opinion, and in no way reflects the opinions of the management per se. Furthermore, the fact that I disagree with you on this matter in no way effects my opinion of you as a helpful contributor to these forums.
Thanks NeoPa! I don't remember my previous post so I could end up contradicting myself. Sometimes I play devil's advocate just to be a jerk. But here's the thing. I have been in corporations that rely on Excel macros because they are quick to code when you don't need a massive application. I'm speaking based on experience. If I was running a corportation, macros wouldn't be the method of choice.
If I have the need for something simple (example: one time assign unique IDs in multiples of 10) I will create a macro because it will save time sitting and going 10 enter 20 enter 30 enter .... 5500 enter 5510 enter .... n enter. In this instance, the maco is only to be used by me in a 1 shot deal. Another example is a program we're working on that deals with addresses,
The addresses in Excel link to another DB table (after import to Access) based on the address. The issue was when the user entered ROAD and RD was in the DB. I created a quick fix macro to zip through the Excel file and change everything to short form. For me that was the simplest solution, a bunch of "Cells.Replace" statements in a macro.
Are macros the best solution? No. Do they have their place in the coding world? I think they do. In certain circumstances there's no need to waste time and memory space on a full out app. The question was will they become obsolete? I will have to say no.
- LB
NeoPa 32,554
Expert Mod 16PB
LB,
As you say (I'm blatantly paraphrasing here ;)), there is a danger of going over the same old stuff unless you read the whole conversation.
I have changed the title of the thread to make it clear to everybody that Excel macros are no part of this discussion and why.
It has been answered a number of times already in earlier posts but no-one is suggesting that Excel macros are becoming obsolete. Quite the reverse. They are a very valuable tool and the fact that they can be created by the operator recording his actions is only further reason for liking them.
Access macros, on the other hand, are written in a form which is not re-usable elsewhere; are not standard in any way; ... The reasons are also explained earlier and don't need repeating.
If I sound impatient and have let this show, then I apologise. I do appreciate what you and many others put into this site. After all, where would we be without all you guys.
LB,
As you say (I'm blatantly paraphrasing here ;)), there is a danger of going over the same old stuff unless you read the whole conversation.
oops, sorry! I was trying NOT to do that. Merely expressing my opinions. Yeah, Access macros suck.
NeoPa 32,554
Expert Mod 16PB
Your opinions are always welcome LB :)
I also agree that they will not be phased out any time soon (nor should be, but only for backwards compatibility).
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Adonis Walmsley-McCarthy |
last post by:
Hello all,
Does anybody know how to programmatically set the macro security settings to
"low" in MS Access 2003?
The reason why I am asking is because I set the security settings to low...
|
by: Henners |
last post by:
Hi There
We are migrating our network file system from Novell to Windows. (There are
pros and cons)....
In this process, we have noticed that a good bunch of user created access
databases...
|
by: kkrizl |
last post by:
I've tried to research this problem, and I haven't been able to find
any references to it. Probably because I shouldn't be doing it, but it
was working, and now it's not.
I'm trying to develop a...
|
by: kkrizl |
last post by:
I've tried to research this problem, and I haven't been able to find
any references to it. Probably because I shouldn't be doing it, but it
was working, and now it's not.
I'm trying to develop a...
|
by: xirowei |
last post by:
i now learning Object Oriented Programming but stuck. Need help. Below is the code.
PanelOption.java
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import...
|
by: dolphin |
last post by:
Hello everyone! Can a static member function access non-static member?
I think it is illegal.Is it right?
|
by: vdraceil |
last post by:
Is vb6.0 really becoming obsolete?Almost everyone around feels proud to say that they are a '.Net programmer' as it has become much popular..Even companies prefer .Net programmers!!
Do companies...
|
by: phill86 |
last post by:
Hi,
I have an access 2010 database that I want to convert to an SQL Server database and I need to know if the data macros in access will still work in the SQL database or will i have to create...
|
by: MeoLessi9 |
last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: Aftab Ahmad |
last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below.
Dim IE As Object
Set IE =...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: marcoviolo |
last post by:
Dear all,
I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
| |