Solved

Access 07 - VB Code or Macro?

Posted on 2011-09-04
6
333 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
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
Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

 

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

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

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

This collection of functions covers all the normal rounding methods of just about any numeric value.
Article by: Leon
Software Metering within our group of companies has always been an afterthought until auditing of software and licensing became a pain point. Orchestrator and SCCM metering gave us the answer and it was an exciting process.
The viewer will learn how to simulate a series of sales calls dependent on a single skill level and learn how to simulate a series of sales calls dependent on two skill levels. Simulating Independent Sales Calls: Enter .75 into cell C2 – “skill leve…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

791 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