Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 250
  • Last Modified:

Import an access Object using VB code

  I am trying to import an object using VB code.
   For instance, I have several DB's that all use the same Module. Currently when I change the module I am forced to change it in each DB (10+ locations). I guess you could say, I am looking to centralize redundant code. Essencially, I would like to store any generic code in one Main DB. Then any changes could easily be made to one specific location, without having to update 10+ different DB's.
   Is there a way to use VB code to import specific objects (module,form,table) from one DB to another? I would appreciate any Ideas. Thanks in advance...
0
Rochedog35
Asked:
Rochedog35
2 Solutions
 
QJohnsonCommented:
Not a great idea for purists, but pretty efficient in my opinion.

When you add an object to your vb apps, you have a dialog offering you New or Existing.  Just choose existing and point it at the folder that has your 'master' copy of the module in question.  

If you keep it under source safe control, you can just add it to a project as a shared file, of course.  

The purists would say that you should consider packaging the module in a ActiveX DLL project if the code is fairly stable.  Then you can reference it when ever you want in other projects and never have to wonder whether you have accidentally changed its source (since you can't).  There is some merit in this thinking if the module is REALLY stable.  But it's pretty easy to get bitten by compatibility issues after changes are made.  So look at this issue carefully before leaping.

QJ
0
 
i014354Commented:
You can use the DoCmd.TransferDatabase with the appropriate parameters to import the modules, forms, tables, etc. from other databases.
0
 
ayufansCommented:
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

- Points split between QJohnson and i014354

Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER !

ayufans
Cleanup Volunteer
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now