Can Access open a Database on Startup?

A

Author

Sorry if this has been answered already, but I did look...
I set up Windows Task Scheduler to open Access every 10 minutes, and I would
like to have Access open a database on startup. If this is possible, my plan
is to then write an autoexec macro that will run a query, then close the
database. This would be optimal, as I need to refresh a table's contents by
running a lengthy query several times a day, and the process would be
(largely) automated.
 
G

Graham R Seach

I assume you're calling Access using a shell script, in which case all you
need to do is append the /x command line switch (and of course, create the
macro in Access).

"path to msaccess.exe" "path to database.mdb" /x mymacroname

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
 
A

a a r o n _ k e m p f

you should be using SQL Server Agent if you want to do something like
this

Honestly, it's built in functionality
 
K

Klatuu

What "exactly" do you mean by open a database?
What you describe so far is not a problem. The only thing you need to do
is link the tables you are going to query to the mdb you are opening.
 
A

Author

When Task Scheduler opens Access, that's all it accomplishes. I then have to
open the .mdb file and navigate to the query I wish to run. If I could have
this done when Access is opened, I would have myself a machine of epic
grandeur. Right now I have a very helpful application of Windows. X_X
What Graham Seach suggests is likely an excellent solution; however, I am
not awesome or savvy enough to understand it. It seems to me that the answer
to my question is "Not the way that Access is currently configured."
My gratitude for your assistance, kind sirs.
 
G

Graham R Seach

Well, if you don't feel "...awesome or savy enough...", that's what we're
here for. Ask and ye shall receive.

What don't you understand?

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
 
A

Author

VBA and SQL script was all foreign to me as of Monday. I guess I'm not as
cool as I previously though, if I don't know what shell script is... o_O
What program will I write shell script in? Upon google search, it sounds
like I might have to use C:\ in my case.
I'm using Windows XP and Access 2003. I suspect the company I work for may
have IT restrictions to what programs I'm allowed to open/modify, and my
brain might have some restrictions on what I can grasp. I just checked, and
I do have access to the Command Prompt.
As for Aaron Kempf's reply, I do appreciate the suggestion. What/Where is
SQL Server Agent? Is it available for (free) download? Would it be included
already in my version of Access?
Thanks a bunch for bearing with me, guys.
 
K

Klatuu

First, ignore anything Arron Kempf has to say.

If you want to run an Access application from the Windows Task Scheduler,
you need to have something set up in Access Startup Options so it will begin
executing when the mdb file is opened.

For your purposes, the easiest thing to do is create a Macro in Access that
runs your query. Name the Macro Autoexec. Any time you open an mdb file
that contains a macro named Autoexec, it will run the macro.

Also, to help get you started using Access, here is a site with some good
basic information:

http://www.accessmvp.com/Strive4Peace/Index.htm

Best of Luck to you.

When you want to open your mdb without running the macro, you hold downt the
Shift key while opening the application.
 
A

Author

Crystal rocks my world. I have her entire tutorial sitting on my desk- if it
weren't for her I wouldn't have gotten this far.
It looks like I'll have to settle for opening the .mdb file manually, and
then letting the Autoexec macro take over.
Thanks for your prompt responses, Dave!
Have a great weekend...
 
K

Klatuu

No, you can still use Windows Task Scheduler.
I have 2 different mdbs where I do this. One runs daily, the other weekly.
The other option that Graham was describing is very similar. In the command
line in Task Scheduler where you run Access and tell it to open a specific
mdb file, you add a command line option. The /x Option tells Access to run a
maco. You follow it with the maro name.

For example, here is the command line for my daily run:
"C:\Program Files\Microsoft Office\OFFICE11\MSACCESS.EXE"
"C:\Development\AMSI\AMSI Downloader.mdb"

It has an Autoexec macro, buit if I wanted to run a macro named foobar, it
would look like this:
"C:\Program Files\Microsoft Office\OFFICE11\MSACCESS.EXE"
"C:\Development\AMSI\AMSI Downloader.mdb /x foobar"

The main difference being that if you don't have a macro named autoexec, you
don't have to remember to hold down the Shift key if you don't want the macro
to run. Another advantage is you could use the same mdb file to do different
activities at different times by specifiying different macros.
 
P

Please Learn to Read

Thank you for your interest, but he question was not "In your opinion, what
server database should I be using?" The question is accurately summarized in
the Subject line. Reading courses for the illiterate are often offered free,
or at low cost, by local welfare and educational agencies.
 
A

a a r o n _ k e m p f

the _FREE_ educational resources that are available for learning SQL
Server outnumber the total resources for Access

Access is obsolete. SQL Server is the mainstream.

-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