Convert Macros to VBA

sross81

Registered User.
Local time
Today, 08:59
Joined
Oct 22, 2008
Messages
97
I have a database that is highly driven by macros. I have been working on rewriting the VBA where I know how. I ran the performance analyzer on a few macros and it said to use the convert to VB tool and I did that and it converted it to VB and I am not sure how to use the VB code for example where do I put it now or does it automatically use it?

For example I have a macro that is run as autoexec when the database opens, and others that run after a button on a form is clicked.

Should I just be copying the code into the correct object event like the click event, etc?

Thank you.
 
For example I have a macro that is run as autoexec when the database opens, and others that run after a button on a form is clicked.

Autoexec I see as a special case. I use Autoexec macros in my applications, with one macro event - to open the default form - and that is the extent of my macro usage. So I would leave that macro alone... just have it open the default form.

For the other macros, yes those could/should be converted to VBA.

For example where to send events to... a button click event, inspect the event properties of the button, and you can click the drop down list of what to fire when the button click happens. You may choose to fire a macro, or you may choose "[Event Procedure]" from the list, next push the "[...]" button next to the pick list, and that will open the VBA editor having prototyped (written the shell of the code for you) an event in VBA code.
 
Thank you both for your response. So I definitely need to copy the converted code into an actual click event.

That is good to know that autoexec runs before table links are checked.

I am going to continue to rework it. The entire database needs rebuilding.
 
I used the tool to convert Macro to VBA. But it kept showing : The data macro 'Settings.Gettings' could not be found. Can you please explain a little more in details how to replace Macros with VBA? Thanks!
 
I used the tool in the macro that says convert macro to VBA and all it did was create a module with the macro. I just copied the code from the macro that got converted into a module into the click event of the actual object on the form.

For example I went to VB and looked at modules and found the converted macro. It names it accordingly. Then I copied the code. I went to my form and then went ot the properites of the button, or drop down list, etc and went to the events and inserted the vb code instead of having it call the macro.

I ended up rewriting the converted code some, but it gives you the general idea of what you are trying to replicate.
 
Thanks for you both replies. I modified Northwind Traders and tried to split the data into FE andBE. It didn't work. I converted Macros to VBA. The database even didn't run before splited.
 

Users who are viewing this thread

Back
Top Bottom