Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Converting macros to Visual Basic...should I?

Status
Not open for further replies.

storer

Programmer
Mar 27, 2000
41
US
Should I convert my macros to visual basic? What are the advantages and/or disadvantages? If I do convert, can I then go to the macro tab and delete the macros? Is that a good or bad idea? I'm still learning so macros are easier for me to deal with but I am slowly but surely learning VB and have the impression that is the better way to go. Will my database (which is replicated) run any faster and/or be any smaller? Thanks! [sig][/sig]
 
Yes.
It will speed things up although this is only noticable on big macros really. The coding will also give you more control and power. Not sure about size.
But, be careful where you place them - It can become very frustrating debugging a piece of code that is available to an entire database only to find after three days that your report is running the copy of the code imbedded in the report. [sig][/sig]
 
Thanks for your reply! I'm not sure I understand what you mean by being careful where I place it. What I was planning on doing is opening the form in design view, clicking on tools and clicking on convert form's macros to visual basic, which changes the event from a macro to an event proceedure in visual basic. I'm under the impression I can then delete the macro and the event will run on the vb code. Am I thinking straight or am I heading down the wrong path? I'm not good at debugging...I'm still learning. [sig][/sig]
 
You're on the right track. Once you've converted it the macros are just taking up space. Read up on Class Modules and Standard Modules. They can mean the difference between having your piece of code available to only the form it is in and whether the code can be called from any other part of the database. [sig][/sig]
 
Hi,

another YES!,

vba has a number of advantages, there are things that simply can not be done by macro's, there will be pian but after the steep learning curve you will have skills that can be used for access, the rest of the ms stuff and VB.

i have only ever used 1 macro, Access 2 "autoexec", you will need to change the "on event" from the "macro" to a function/sub function event procedure. You will also find that functions/subfunctions will not be directly equivalent (the pain) ;-) [sig][/sig]
 
definitely - it was easier than expected, but there are some gotchas. [sig][/sig]
 
Forget about the benefits of using VBA as opposed to macros. Your question has got to be do you need to ?

1. Does you db work well at the moment ?
2. Have you got some other to do ?
3. Are you planning major work on the db ?

If you answered yes to 1 and 2 and no to 3 then the answer to your question is NO.

But, you should definitely use VBA in your next project.

[sig]<p>Bill Paton<br><a href=mailto:william.paton@ubsw.com>william.paton@ubsw.com</a><br><a href= Check out my website ![/sig]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top