Can I extract VBA code from *.mdb file and run VB program from outside the database ?

T

Tony Bansten

I have a *.mdb Access database which contains VBA code with a couple of forms.

Can I somehow extract all the VBA code into an external file (or multiple files)
and run the VB code from there (including forms and databases accesses of cause) ?

Tony
 
S

Scott McDaniel

I have a *.mdb Access database which contains VBA code with a couple of forms.

Can I somehow extract all the VBA code into an external file (or multiple files)
and run the VB code from there (including forms and databases accesses of cause) ?

You can't run VBA code from a text file, and you can't run Access Forms or Reports outside of Access. You can automate
Access and run code in a database, or behind a form.

What exactly are you trying to do? Perhaps there's an easier way ...

Scott McDaniel
scott@takemeout_infotrakker.com
www.infotrakker.com
 
A

Albert D. Kallal

Tony Bansten said:
I have a *.mdb Access database which contains VBA code with a couple of
forms.

Can I somehow extract all the VBA code into an external file (or multiple
files)
and run the VB code from there (including forms and databases accesses of
cause) ?

You can move the code from a forms module into a standard code module (you
have to still call the code from the form). And, you can build a library of
code that you use,and place that code into a mde, and set a reference to
that mde, and thus run code in that external file. But, you can't just
wholesale remove the code out to a separate file.

So, you can use common "libraries" of code by placing that code in a mde and
as mentioned setting a reference to that mde.

And, to really answer your question, yes..you should and can remove all code
and forms from the database. This process is explained here:

http://www.members.shaw.ca/AlbertKallal/Articles/split/index.htm

For the most part, we don't place any code with the data. So, what you
supposed to do is extract all code + forms etc. OUT OF your data file. So,
your question makes sense in that regards. You need to use what is called a
split database....
 
J

John Blessing

Tony Bansten said:
I have a *.mdb Access database which contains VBA code with a couple of
forms.

Can I somehow extract all the VBA code into an external file (or multiple
files)
and run the VB code from there (including forms and databases accesses of
cause) ?

Tony

Probably not without modification

--
John Blessing

http://www.LbeHelpdesk.com - Help Desk software priced to suit all
businesses
http://www.room-booking-software.com - Schedule rooms & equipment bookings
for your meeting/class over the web.
http://www.lbetoolbox.com - Remove Duplicates from MS Outlook, find/replace,
send newsletters
 
G

Guest

Hi Tony,

Access VBA needs to run in an Access Datatbase to work properly. I am not
sure what you want but I will share the following information.

Allow me to suggest some ways to get the code.

1. Open the database file with the code. Then Open the VBA editor. Open a
module by double clicking on it in the list on the left. Select all of the
code and then past it into something like MS Notepad. If you save it with a
bas file extension then it can be imported into other Access Database from
the VBA Editor.

2. Open a different Access Database or create a new blank DB. From the Menu
Bar select File > Get External Data > Import. Select the Forms or Modules
you want.

3. Open the Database with the code you want. Open the VBA Editor. Select a
module. From the Menu Bar Select File > Export.

If you want to Link to Access tables from another Database that is a
different matter entirely.

Hunter57
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top