Link to home
Start Free TrialLog in
Avatar of SommerAlain

asked on

Connection between 2 databases

I have 3 Access databases using similar modules.
For easing the maintenance of the modules, I would like to locate the modules in one database and to use those modules in the 2 other databases.
Is it feasible?
Avatar of Jim Dettman (EE MVE)
Jim Dettman (EE MVE)
Flag of United States of America image

Link to home
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Also should add that these are referred to as "Library" DB's and you should be aware of CurrentDB() vs CodeDB().

Depending on the operations you are performing, it may be important to know where the code is executing.  

See the on-line help for CodeDB() for all the details.

Avatar of SommerAlain


Hi Jim, Thank you it looks clear. I will see it later today. I mainly use sql code. Is there somthing specific?
Have a nice day
Also what some Access developers do is simply store all their "useful" codes in one simple text file

The code in your MDA file should only contain the code needed for that particular system


In DataBase A I have a sub like this one:

Private Sub CalculateXXS
Call CalculateComplex("TableLocalTable")
End Sub

Imagine that the code of the sub CalculateComplex is in DataBase B and that the TableLocalTable is in DataBase A.
How to adapt this code to make it work?

Best regards
In this case, there is nothing you would need to do.  When you need to use CodeDB() is if your code is referring to objects in the library DB.

CurrentDB() always points to the DB open in the Access interface.  CodeDB() may or may not be different depending on the procedure that is currently executing and where it is.

This is actually how all the Access Wizards are written that you use, and things like the F2 Zoom Box.