Get results from a function in another (local) database?

G

Guest

This code calls a subroutine in an external DB:

(code in a module in "ThisDB.mdb")
Dim AppAccess As New Access.Application
With AppAccess
.OpenCurrentDatabase ("c:\MyDir\ThatDB.mdb")
.Run "ThatDB.MySub"
........

QUESTION: is there a comprable method for ThisDB to get results from a
FUNCTION in ThatDB? What if the function returns a complex, user-defined
datatype?

I don't want to create a tools-reference to the external db, is I can avoid
it.

Leonard
 
G

Guest

Alex

Thanks for your response. I think you are probably correct.
I've been thinking of a workaround: A subroutine that writes its
results to a disk file, which the calling program can access. Of
course it would work, but it feels very 1979. Right now, I'm
working on another approach: making the external module
into a class and turning the functions into properties.

Thanks again
Leonard
 
6

'69 Camaro

Hi, Leonard.
I don't want to create a tools-reference to the external db, is I can
avoid
it.

The best way to run a function in another database is to use that database
as a library reference. But it's not the only way.
QUESTION: is there a comprable method for ThisDB to get results from a
FUNCTION in ThatDB?
Yes.

What if the function returns a complex, user-defined
datatype?

You won't be able to return a complex user-defined data type with that code
architecture, only standard data types, such as strings, dates, and numbers.
One way to accomplish your task without the use of a library database is to
have the function in ThatDB write the data in the complex data type to a
record in ThatDB's local table, and then have ThisDB use a remote query to
read the record, then (possibly) delete the record after it's no longer
needed.

HTH.
Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips and tutorials.
Blogs: www.DataDevilDog.BlogSpot.com, www.DatabaseTips.BlogSpot.com
http://www.Access.QBuilt.com/html/expert_contributors2.html for contact
info.
 

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