Solved

Access 07 - VB Code or Macro?

Posted on 2011-09-04
6
309 Views
Last Modified: 2012-06-27
Hi yall!  I am a novice programmer that started out years ago in Basic, and then Visual Basic, and now I mainly play with VBA in Access, currently AC07.

Not being a professional, most of what I create is from examples and borrowed code.  I am more comfortable with code, and was never a fan of macros.  I noticed that AC07 has a function to convert macros to code.

My question is: Why not do this?  Is there a reason that a macro would work better than code.  Is code faster, slower, etc.  Have you run into the coversion routine causing a previously working function to stop working when converting to code?

Looking for some informed opinions and an education ....
0
Comment
Question by:callstate
6 Comments
 
LVL 13

Assisted Solution

by:Ashok
Ashok earned 100 total points
Comment Utility
Is code faster?
Yes

You can find and learn almost everything using Internet Search engine.

http://www.anthony-vba.kefra.com/vba/vbabasic2.htm

http://www.mrexcel.com/articles.shtml#Formulas

HTH
Ashok
0
 
LVL 21

Accepted Solution

by:
Boyd (HiTechCoach) Trimmell, Microsoft Access MVP earned 200 total points
Comment Utility
There are many advantages to using VBA code.

Pros:
1) It is compiled.
2) Has error handling.
3) Easy to protect.
4) Can do many things Macros can do,

Cons:

Uh ... not sure if there are any

About macros:

Starting with Access 2007 the Macro Editor have been improved. The improvements continued in 2010.

With the improvement of macros you can do more without VBA code. This was to make the it more safer from security risks form VBA.  So in Access 2007 is you used only macros you did not have to worry about trusting your VBA code.

In Access 2010 the new web database was introduced. It does not use any VBA code. Only macros.

For security reason Macros are still limited in what the can do. VBA is a very powerful programming language.  In the past I l used VBA for everything except the  few things only macros can do.   I have been experimenting with Embedded Macros in 2007/2010.    

If I want a web app I would use ASP.net or some other platform before I would  Access.
0
 
LVL 3

Assisted Solution

by:sofsol
sofsol earned 100 total points
Comment Utility
Many business users only ever want to get a problem solved and move on - which macros lets them do faster if they don't have the VB background. People who want to get serious will use the macro converter to learn VB, and if you have the VB knowledge then VBA is the way to go.
0
Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

 

Author Comment

by:callstate
Comment Utility
I do have a novice VB background, and I am primarily a business user.

The database project that I am working on is only used in my business, and will not be shared outside of out LAN, so I do not believe I have 'trusting' issues.

An issue I have experienced is using the 'convert macro to vb' function, and then having to figure out why the code won't work.  Usually syntax errors like quotes being there, etc.

I was wondering if this was a common problem when using this function
0
 
LVL 74

Assisted Solution

by:Jeffrey Coachman
Jeffrey Coachman earned 100 total points
Comment Utility
< I noticed that AC07 has a function to convert macros to code.>
IIRC, all versions of Access since 2000, had this utility...

In any event...
For the most part, the conversion utility is actually pretty good.
However, "Simple" macros will sometimes convert not so simple (or in many cases, inefficient) VBA code.
Or it will not be inherently obvious how to adapt the "converted" vba to actual code that will work in your database.
So this is more of a "Limitation" than a "problem".

Again, this is why most Access developers will opt for using VBA.

For me, the big issue with Macros is that they are only applicable in MS Access.
No other program (even in the Microsoft world) uses this language.

VBA has it roots in VB, and has evolved into the .net platform.

I am no basher here, ...as was stated, ...if you need to create an MS Access "Web" database specifically, ...then macros are currently your only option.

If you are not creating a Web DB, then I would stick with VBA.

The bottom line here is the 95% of all Access solutions here will be VBA, not macros.
So if you need help with something, more VBA will be available than Macros.
;-)

JeffCoachman

0
 

Author Closing Comment

by:callstate
Comment Utility
Thank you all!
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

We were having a lot of "Heartbeat Alerts" in our SCOM environment, now "Heartbeat" in a SCOM environment for those of you who might not be familiar with SCOM is a packet of data sent from the agent to the management server on a regular basis, basic…
The new Microsoft OS looks great, is easier than ever to upgrade to, it is even free.  So what's the catch?  If you don't change the privacy settings, Microsoft will, in accordance with the (EULA) you clicked okay to without reading, collect all the…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now