Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Access 07 - VB Code or Macro?

Posted on 2011-09-04
6
Medium Priority
?
350 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 13

Assisted Solution

by:Ashok
Ashok earned 400 total points
ID: 36481486
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 800 total points
ID: 36481690
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 400 total points
ID: 36482115
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
The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

 

Author Comment

by:callstate
ID: 36484087
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 400 total points
ID: 36484934
< 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
ID: 36485885
Thank you all!
0

Featured Post

Learn how to optimize MySQL for your business need

With the increasing importance of apps & networks in both business & personal interconnections, perfor. has become one of the key metrics of successful communication. This ebook is a hands-on business-case-driven guide to understanding MySQL query parameter tuning & database perf

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
We live in a world of interfaces like the one in the title picture. VBA also allows to use interfaces which offers a lot of possibilities. This article describes how to use interfaces in VBA and how to work around their bugs.
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

671 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