Scheduled Task and Macro

  • Thread starter Thread starter Michael
  • Start date Start date
M

Michael

I have a Db that has an autoexec macro in it. I have XP open the database
at the same time every night to update data from fresh txt files. I only
need this macro to start automatically when it is opened by the task
manager. If I need to run it other times I could start it manually by
activating the macro.

I saw below about setting a condition based on the current day but I run my
task at night and need to open the DB multiple times during the day to
extract info. Currently I either ctrl Break out or, since the first command
is to find a file on the network, disable my network connection.

Any help is greatly appreciated.

Michael
 
Instead of putting the macro actions in the AutoExec put
them in their own macro. Add the macro name to whatever
scheduler you are using to run this at night.
Ex
"path to Access" "Path to Access file name" "macro name"

Jim
 
Thanks
Jim/Chris said:
Instead of putting the macro actions in the AutoExec put
them in their own macro. Add the macro name to whatever
scheduler you are using to run this at night.
Ex
"path to Access" "Path to Access file name" "macro name"

Jim
 
Is there a specific syntax I am missing?

I am using the Scheduled Task Manager in control panel of windows XP Pro.

I have the RUN box filled like this

"C:\Documents and Settings\Sales\My Documents\Sales Data Generation.mdb"
"import"

That opens the DB but does not run the macro "import" How do I denote that
as a macro?
 
I could not get the macro to run. What you could do is set
up a separate db with the macro named AutoExecto to do the
nightly processing and put that in your scheduler. The
correct systax for Windows Tasdk Scheduler is: Example
"C:\Program Files\Microsoft Office\Office\MSACCESS.EXE"
"c:\my documents\test2c.mdb"

Jim
 
Ok.

Can I use an autoexec macro to open another database execute the "import"
macro then close that database and exit?
 
I ran into this post in my database of posts. Here is the
whole post.

(Q)
How can you run a MsgBox command in one database from
another database. Can you do this with a macro?

(A)
My name is Dennis Schmidt. Thank you for using the
Microsoft Newsgroups.

This following sample demonstrates how you can execute an
Access macro from
another application or database using OLE automation.

<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
<>
*** Resolution *** Dec 9 1999 2:50PM tammyd

1. Create an Access database called C:\TestMacro.mdb
2. Create a macro called macTestMsg with the following action:
MsgBox "Macro in TestMacro database"
3. Create another Access database C:TestMacro2.mdb
4. Create a macro called macTestMsg with the following action:
MsgBox "Macro in TestMacro2 database"
5. In the application you choose, create a reference to the
Access 8.0
Object
Library
6. Create the following sub procedure:
Sub RunMacroX()

Dim objACC As New Access.Application


Set objACC = GetObject("D:\TestMacro.mdb") 'open first database
objACC.DoCmd.RunMacro ("macTestMsg") 'run macro
objACC.Quit
Set objACC = GetObject("D:\TestMacro2.mdb") 'open second
database
objACC.DoCmd.RunMacro ("macTestMsg") 'run macro
objACC.Quit
Set objACC = Nothing

End Sub

I hope this helps! If you have additional questions on this
topic, please
reply to this posting.

Need quick answers to questions like these? The Microsoft
Knowledge Base
provides a wealth of information that you can use to
troubleshoot a problem
or answer a question! It's located at
http://support.microsoft.com/support/c.asp?M=F>.

This posting is provided "AS IS" with no warranties, and
confers no rights.
You assume all risk for your use. © 2001 Microsoft
Corporation. All rights
reserved.

Regards,
Dennis Schmidt
Microsoft Support

Jim
 
Michael,

There is a special switch /x to be used in the command line to run the
macro. You need to do it like this...
"C:\PathToAccess\Msaccess.exe" "C:\Documents and Settings\Sales\My
Documents\Sales Data Generation.mdb" /x import
 
Back
Top