Solved

Access 07 - VB Code or Macro?

Posted on 2011-09-04
6
348 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 100 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 200 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 100 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
Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

 

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 100 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
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 …
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses

623 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