Reference an external Application

  • Thread starter Thread starter JonWayne
  • Start date Start date
J

JonWayne

Is there any way to reference the Application object of an external
database?
The thing is, I want to use the D* functions on tables in external dbs and
since those functions are properties of the application, I need to point an
application object variable to that db's app.
 
JonWayne said:
Is there any way to reference the Application object of an external
database?
The thing is, I want to use the D* functions on tables in external
dbs and since those functions are properties of the application, I
need to point an application object variable to that db's app.

I'm not sure you're thinking about this the right way, but I'm not sure
what you're after so I can't say for sure. By "the D* function", are
you talking about the domain aggregate functions, such as DLookup,
DCount, DMax, etc.? Is the external database expected to be open in a
separate instance of Microsoft Access at the time you want to call these
functions? If so, it may make sense to set an object variable to that
instance and call the functions from that object, but if not, I don't
think it makes sense to open a separate instance of Access just to load
the external database to query it. It's not necessary.

If all you want to do is get values from tables in an external database,
you can (a) link to those tables in the current database and then call
the domain aggregate functions on the linked tables, or (b) open a DAO
Database object on the external database and then use that object to
open recordsets on queries of the tables in that database, or (c) not
even bother to open a second Database object, but use the IN clause in
queries executed from the current database to specify that the table to
be queried is in a different database. Option a would be best if you're
going to do this a lot, and the external database is always in the same
location. Option b would probably be best if the conditions for option
a aren't met, but you plan to run more than one query in the current
process. Option c is probably the least efficient approach, but it's
simplest if you're only going to run one query.
 
Back
Top