Run query in another database at startup

J

Janelle.Dunlap

Is there a way to write code in one database (db1) so that when I open
another known database (db2) it will run a query that I specify at
startup ? The query is created in db1 and I have written vb code to
copy it over to db2. However, because of the complexity of my database
I need to automate the process of running the query from within db1. I
have played around with creating an AutoExec macro in db1 and copying
it over to db2 , but I don't want the macro to run in db1, just db2.
If I delete the macro from within db1, I will not be able to use it
again when I want to create a new database (db3).
 
J

Janelle.Dunlap

Nevermind, I figured it out. Easy enough, just save the AutoExec macro
in db1 with another name and when it's copied to db2 name it as
"AutoExec".

DoCmd.CopyObject strSaveFileName, "AutoExec", acMacro, "Macro"
 
D

dbahooker

or you can use a SQL Server based Access Data Project and you can have
real scheduling capabilities.

you can schedule data being moved from point A to point B without
typing a single world; it is called the 'import / export data wizard'
or something along those lines

it requires sql client tools; but all companies have sql server
somewhere.

I mean; SQL Server owns the friggin market anymore.

I would reccomend using the SQL Server developers' edition on your
desktop in conjunction with a couple of MSDE databases.

it works like a charm; and it's like what.. free??

-Aaron
 

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