run module in external database

G

Guest

Let me explain the scenario:

I have a database holding large tables that requires refreshing and there is
a module to do this
dbName = BigTables.mdb , module = import1 [containing public function
importa()]
I have a second database which holds queries and acts (hopefully) as a
controller for the other database
dbName = control.mdb

what code do I use in the control.mdb to import data into the BigTables.mdb
using the existing module and import specifications? I saw some mention of it
as an aside in a question about running external queries but when I tried to
apply it it became clear I had got it fundamentally wrong.
I understand I am supposed to reference a database, but not which database
gets which reference. When I tried to run my code it ran successfully - but
into the wrong database. Instead of refreshing BigTable.mdb I got a new table
in control.mdb.
Incidentally how do you delete a reference from the VBA project explorer if
you got a dud reference in by mistake? Unchecking it in the Tools>References
still leaves it sitting there and can interfere with a corrected entry?

Thanks for your help.
 
G

Guest

In your BigTables.mdb database create a macro with action runcode importa()
then from controldb create a function with an access.application object,
reference this database to bigtables and then call the macro, review the help
file for all the details in referencing an application object,
 
G

Guest

Thanks, but as I already said that I was confused with existing details to
hand and my attempts at writing the code was not producing the correct
results that really doesn't help.
Is it necessary to have the macro? Can the function not be called directly?

jl5000 said:
In your BigTables.mdb database create a macro with action runcode importa()
then from controldb create a function with an access.application object,
reference this database to bigtables and then call the macro, review the help
file for all the details in referencing an application object,

--
jl5000
<a href="http://www.joshdev.com"></a>


Alan UK said:
Let me explain the scenario:

I have a database holding large tables that requires refreshing and there is
a module to do this
dbName = BigTables.mdb , module = import1 [containing public function
importa()]
I have a second database which holds queries and acts (hopefully) as a
controller for the other database
dbName = control.mdb

what code do I use in the control.mdb to import data into the BigTables.mdb
using the existing module and import specifications? I saw some mention of it
as an aside in a question about running external queries but when I tried to
apply it it became clear I had got it fundamentally wrong.
I understand I am supposed to reference a database, but not which database
gets which reference. When I tried to run my code it ran successfully - but
into the wrong database. Instead of refreshing BigTable.mdb I got a new table
in control.mdb.
Incidentally how do you delete a reference from the VBA project explorer if
you got a dud reference in by mistake? Unchecking it in the Tools>References
still leaves it sitting there and can interfere with a corrected entry?

Thanks for your help.
 
G

Guest

To clarify this is my code - it runs, but creates a table in the calling
database (control.mdb) rather than the native BigTables where I intended. The
control.db has a reference to BigTables added. Is there something I should be
adding into the module to ensure the reference to importing is in a named
database?
For some reason all help file references to OpenDatabase and related items
generate an error which I can't repair, both on my home machine and on my
work machine, so *please* don't refer me to this. I'm on Access 2000, btw.

Dim dbs As DAO.Database
Set dbs = OpenDatabase("T:\BigTables.mdb")
BigTables.Importa
Set dbs = Nothing

Alan UK said:
Thanks, but as I already said that I was confused with existing details to
hand and my attempts at writing the code was not producing the correct
results that really doesn't help.
Is it necessary to have the macro? Can the function not be called directly?

jl5000 said:
In your BigTables.mdb database create a macro with action runcode importa()
then from controldb create a function with an access.application object,
reference this database to bigtables and then call the macro, review the help
file for all the details in referencing an application object,

--
jl5000
<a href="http://www.joshdev.com"></a>


Alan UK said:
Let me explain the scenario:

I have a database holding large tables that requires refreshing and there is
a module to do this
dbName = BigTables.mdb , module = import1 [containing public function
importa()]
I have a second database which holds queries and acts (hopefully) as a
controller for the other database
dbName = control.mdb

what code do I use in the control.mdb to import data into the BigTables.mdb
using the existing module and import specifications? I saw some mention of it
as an aside in a question about running external queries but when I tried to
apply it it became clear I had got it fundamentally wrong.
I understand I am supposed to reference a database, but not which database
gets which reference. When I tried to run my code it ran successfully - but
into the wrong database. Instead of refreshing BigTable.mdb I got a new table
in control.mdb.
Incidentally how do you delete a reference from the VBA project explorer if
you got a dud reference in by mistake? Unchecking it in the Tools>References
still leaves it sitting there and can interfere with a corrected entry?

Thanks for your help.
 

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