Results 1 to 8 of 8
  1. #1
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts

    Running a function in another database (Access 2003)

    Is it possible to run a function in another database from the database i'm in?

  2. #2
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Running a function in another database (Access 2003)

    You'll have to explain more about the situation Pat. Is the other database a library, is it open, is it referenced? What exactly are you trying to accomplish?
    Charlotte

  3. #3
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts

    Re: Running a function in another database (Access 2003)

    what i want to do is to run a function in another database, no the database i want to run it in is not library database, no it's not open. The database where the function resides updates it's own tables. i can then link to these tables from the other database and reference the tables results.

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Running a function in another database (Access 2003)

    You can set a reference to the database containing the code, in Tools | References... in the Visual Basic Editor. You can then call public functions and procedures just as if they're in the current database. But whether the code will do what you want depends on how it is written. For example, CurrentDb and CurrentProject will be interpreted as referring to the currently open database, not to the database containing the code. You can use CodeDb to refer to the database that contains the code.

  5. #5
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts

    Re: Running a function in another database (Access 2003)

    Thanks for the info Hans, there is use being made of CurrentDb and CurrentProject so i will use CodeDb to overcome this problem.

    I will try this and see what happens. Otherwise i will just import all the code and tables into the operating database.

  6. #6
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Running a function in another database (Access 2003)

    CodeDb is the DAO counterpart of CurrentDb. Its ADO equivalent is CodeProject (the counterpart of CurrentProject).

  7. #7
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts

    Re: Running a function in another database (Access 2003)

    so i could use CodeDb instead of CurrentDb in any database i use, is that right?

  8. #8
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Running a function in another database (Access 2003)

    If you want to refer to the database that contains the code rather than the currently open database, yes. But if you want to store some commonly used code in a library database, so that you don't have to copy it to each database where you need it, you'd probably want to use CurrentDb, so that the code refers to the currently open database.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •