Solved

Running a subroutine automatically

Posted on 2007-11-26
3
693 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

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.

773 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