Calling a module from another program

jobrien4

Registered User.
Local time
Today, 16:23
Joined
Sep 12, 2011
Messages
51
I have a database setup that has 10-15 concurrent users. Recently I setup a module that contains a lot of functions that this database uses. I also have other programs that could utilize those same functions. It is possible that I will need to modify the functions from time to time.

Is there a way for me to save the Module containing the functions and have both of my programs call the module as needed?

I would like to make it so that if I modify the functions in that module, all programs instantly get the updates. This would also allow me to update the functions without sending new front end versions out to all of the users.

I see I can export a module and save it as a .bas then open that up in note pad and modify the text in there. So can I make my current databases call that .bas file? Or is there a more elegant way of doing this?
 
Put the code into a separate database and link it as a reference.

+
If you use a lot of references to CurrentDB() you will need to change them to CodeDB() instead.

So if I had a db called codelib with this in a standard module

Code:
Public Sub gettables(db As DAO.Database)
    For Each t In db.TableDefs
        Debug.Print t.Name
    Next
End Sub

I could reference codelib like any other exe/dll and use

Code:
Private Sub Command0_Click()
    codelib.gettables CodeDb
End Sub

correction ++

Using currentdb from codelib would list the tables of codelib. If you wanted to list the tables from the currently open database from codelib, you need to use CodeDB().

clear as mud?
 
Last edited:

Users who are viewing this thread

Back
Top Bottom