run queries or open a form from one database to another

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Is there a way I can call to run queries that are in different database? If
not, is there a way to open a form that is in another database?

The queries that i want to run is a append queries. for example:
I have append queries in database 1, which is appending it to table in
database 2. Instead of going into database 1 to run the queries, i would
like to run it from database 2, since this is the database I will be using.
or

i have can create a form in database 1 with command button that runs append
queries. If i can open that form from database 2... that will work too.


Thank you!
 
You can use reference from MDB1 to MDB2, so MDB1 will recognise all the
functions in MDB2.
Open MDB1, when you are in code (any where), select tools, reference. browse
and select MDB2.
You will notice that MDB1 recognise all the functions, but it wont recognise
forms, reports, macros etc, so if for example you want to open a form in MDB2
From MDB1, create a function in MDB2 that open the form, and then call that
function from MDB1, the same about queries, mdb1 wont recognise queries on
mdb2, but you can create a function in mdb2 that run the query, and you can
call this function from mdb1.
 
THANK YOU SO MUCH!! Works like a charm!

Ofer said:
You can use reference from MDB1 to MDB2, so MDB1 will recognise all the
functions in MDB2.
Open MDB1, when you are in code (any where), select tools, reference. browse
and select MDB2.
You will notice that MDB1 recognise all the functions, but it wont recognise
forms, reports, macros etc, so if for example you want to open a form in MDB2
From MDB1, create a function in MDB2 that open the form, and then call that
function from MDB1, the same about queries, mdb1 wont recognise queries on
mdb2, but you can create a function in mdb2 that run the query, and you can
call this function from mdb1.
 
Ofer,

How would you do tjis in code?

Thanks!



Ofer said:
You can use reference from MDB1 to MDB2, so MDB1 will recognise all the
functions in MDB2.
Open MDB1, when you are in code (any where), select tools, reference.
browse
and select MDB2.
You will notice that MDB1 recognise all the functions, but it wont
recognise
forms, reports, macros etc, so if for example you want to open a form in
MDB2
From MDB1, create a function in MDB2 that open the form, and then call
that
function from MDB1, the same about queries, mdb1 wont recognise queries on
mdb2, but you can create a function in mdb2 that run the query, and you
can
call this function from mdb1.
 
In Mdb2 create a function in a module.

Function FunctionName()
Docmd.OpenForm "FormName"
End Function

In Mdb1, add reference to Mdb2.
Now any where in Mdb1 if you run the FunctionName() created in Mdb2 it will
run this function
 
Back
Top