Solved

Running a subroutine automatically

Posted on 2007-11-26
3
691 Views
Last Modified: 2013-11-27
I am using MS Access 2003.

I have a subroutine that will import a .csv file and append it to a master table. I would like this subroutine to run at a set time each morning with no intervention.

Is this possible?
0
Comment
Question by:TylerDerden
  • 2
3 Comments
 
LVL 15

Expert Comment

by:JimFive
ID: 20352617
Create a macro that has two steps:
1.  run your code and
2. exit the database.

In the "control panel" Add a "Scheduled Task"

The Task should be a command line that looks something like:

"C:\Program Files\Microsoft Office\MSACCESS.EXE" "Path\to\access.mdb file" /x MacroName

--
JimFive
0
 

Author Comment

by:TylerDerden
ID: 20353567
Thnx JimFive. I think we may be close.

I'm running on Windows XP Enterprise.
When I get to the schedule a task dialog box the fields to enter are:
Run:
Start in:

For the run option I clicked browse and selected to access database. However, I do not see a place where I can specify with vba module I would like to run.
Also, I do not know what to enter in for start in.

I googled it but the ms site wasn't very helpful.

Any ideas?
0
 
LVL 15

Accepted Solution

by:
JimFive earned 250 total points
ID: 20354889
In the run box, don't select the access database.  You need to have the full command line:

"C:\Program Files\Microsoft Office\MSACCESS.EXE" "Path\to\access.mdb file" /x MacroName


Your MSACCESS.EXE may be in a slightly different location.  your Macro Name goes where I typed MacroName and your access database full path goes where I typed "Path\to\access.mdb"

For start in use the directory where the access.mdb is located.

--
JimFive
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

In the article entitled Working with Objects – Part 1 (http://www.experts-exchange.com/Microsoft/Development/MS_Access/A_4942-Working-with-Objects-Part-1.html), you learned the basics of working with objects, properties, methods, and events. In Work…
A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now