Can you move VBA code out into a separate container?

I am currently developing and/or supporting about 6 different app's, and going crazy with slightly different versions of VBA routines. Can you pull the VBA out of an mdb (2003) and put it in another ?container?, and link to it with a Reference?

If so, any pitfalls? Other than having to completely re-test EVERYTHING to find & fix all the spots that will be broken, due to the coding differences?

I seem to remember seeing an article about this in the past, but can't find it now.

Thanks
mlagrangeAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Jim Dettman (Microsoft MVP/ EE MVE)President / OwnerCommented:
Yes, you certainly can do that.  It's called a library MDB and by convention has a MDA extention.

  This is how the wizards and add-ins work.  

  The only thing you need to be carefull of is at times it's important to know where the code is running.  You use CodeDB(), which is like CurrentDB() except that it points to your MDA and not the current DB.

Jim.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database ArchitectCommented:
Actually, if CodeDB() is used within the 'currentdb', then it returns the (object) Name of the CurrentDB, which in this case is the same as the CurrentDB Method.

mx

0
Jim Dettman (Microsoft MVP/ EE MVE)President / OwnerCommented:
Yes, I didn't say that right; it points to the DB that the code is currently executing in.

 I only use that in MDA's, which is why I goofed myself up.

Thanks for catching that!
Jim.
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

mlagrangeAuthor Commented:
Do mda's still work in Access 2010?  Any problems, documented or otherwise?


0
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database ArchitectCommented:
"Do mda's still work in Access 2010? "
Definitely. For Sure. I have several utilities that are MDA's ... and all work fine.
No specific issues at all.  It's one of the easiest things to do in Access.  An MDA is literally an MDB with an MDA extension.

mx
0
mlagrangeAuthor Commented:
Does this cause any problems during development?
I guess you would have your app front end open, and possibly the VBA Editor, and then the mda with your code, and then THAT VBA editor?  
0
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database ArchitectCommented:
Not quite.  Lets say you have an MDB that has a Reference to your MDA - that contains all your cool special commonly used slick code.

When you have your MDB open, you can ... get to the code in the MDA ... and you can even make **Temporary** changes to test stuff.  BUT ... IMPORTANT ... when you close your MDB, any changes made to the MDA will be **Lost*.  

So ... to actually modify code or other objects in your MDA, you must open it by itself to do so.  Back circa A97 and prior, this was not the case. You could actually modify and save code in the MDA 'live'.  But, that got changed in a later version ... and remains in effect today.

mx
0
mlagrangeAuthor Commented:
Ok, I'm going to give a shot!

Thanks, Guys
0
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database ArchitectCommented:
ok ... I found what I was looking for.  Now, these are mainly about creating MDA's to use as an Add In - you will show up on the (A2003) Add-Ins menu - NOT to be confused with the Add In Ribbon in A2010 - I CAN'T BELIEVE THEY NAMED IT THE SAME (Yes I am shouting, lol).


How To Create:
http://www.databasedev.co.uk/access-add-ins.html



Must Have AddIn:
http://mztools.com/v3/mztools3.aspx

Good list of Add-Ins:
http://www.team-moeller.de/en/?Add-Ins

All time #1 must have AddIn (almost free - pays for itself in first use):
http://www.rickworld.com/products.html#Find%20and%20Replace%209.0

Very cool and free AddIn:
http://www.oaltd.co.uk/Indenter/Default.htm

Not specifically AddIn's per se, but all free and off the chart:

http://www.lebans.com

http://www.everythingaccess.com/tutorials.asp?ID=A-new-method-for-disabling-the-Mouse-Scroll-Wheel-in-Access-forms

And as rocki noted, PetersSoftware has several free tools ... scroll down on the home page to 'Free Downloads:'

More references:

http://www.fmsinc.com/MicrosoftAccess/help.html

http://allenbrowne.com/Access2007.html

http://www.fmsinc.com/TPapers/#CurrentAccess

http://www.mvps.org/access/

http://www.vb123.com/

http://www.fontstuff.com/access/
Capture1.gif
0
mlagrangeAuthor Commented:
WOW! A veritable GOLD MINE of links!

Thanks, Thanks, Thanks!

0
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database ArchitectCommented:
Seriously ... some GREAT stuff.

mx
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.