Returning Results from Function in a different DB

W

web1723

I'm trying to get a module from a different access DB to
return the results of a function to the current DB. Here
is what I've coded so far:

In my current module on db2.mdb...

Dim appAccess As New Access.Application
appAccess.OpenCurrentDatabase ("commondb.mdb")
appAccess.Run "db1.function1", "A"

commondb.mdb is a second DB with a function that returns a
SQL statement that will be used in the module in db2. The
module appears to be working, but I can't get the results.

If I code SQL=appAccess.Run "db1.function1", "A" I get a
compile error.

Any suggestions?
 
B

Bryan Reich [MSFT]

The problem seems to be that you are trying to call the Run function as a
subroutine instead. A subroutine can not return values, so when you are
trying to assign the results to a value the comiler will complain.
Instead, call run in this way:
SQL=appAccess.Run("db1.function1", "A")
The parentheses tell the compiler to call the operation as a function with a
return value and not as a subroutine.
 

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