Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

using autoexec macro and windows scheduled task to run queries

Posted on 2010-08-20
3
Medium Priority
?
607 Views
Last Modified: 2012-05-10
I use auto exec macro, module and windows scheduled tasks to run a query.
Now I want to run two more queries - each at a different time- is that possible?
Module1
Public Function startprog()
DoCmd.SetWarnings False
DoCmd.OpenQuery "qryUpdate"
DoCmd.Quit acQuitSaveNone
End Function
Macro
AutoExec
(action) RUN CODE      
function name

that code is what I am using,
thank you
0
Comment
Question by:davetough
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 668 total points
ID: 33487213
create another .bat file that will run a macro and use the  scheduled tasks to set the time to run the .bat file
0
 
LVL 2

Assisted Solution

by:bartjoosen
bartjoosen earned 668 total points
ID: 33487767
You can make 3 macros, setting 3 entries in the task scheduler,
or maybe set the queries after each other in 1 macro:
Public Function startprog()
DoCmd.SetWarnings False
DoCmd.OpenQuery "qryUpdate1"
DoCmd.OpenQuery "qryUpdate2"
DoCmd.OpenQuery "qryUpdate3"
DoCmd.Quit acQuitSaveNone
End Function

Bart
0
 
LVL 48

Assisted Solution

by:Dale Fye
Dale Fye earned 664 total points
ID: 33487920
Or you could use the scheduler to kick off the application at three different times, and let the application decide which query to run depending on the time.

If TimeValue(Now()) Between #01:30# AND #01:45# Then
    docmd.Openquery "qryUpdate1"
Elseif  TimeValue(Now()) Between #02:30# AND #02:45# Then
    docmd.Openquery "qryUpdate2"
Elseif  TimeValue(Now()) Between #03:30# AND #04:45# Then
    docmd.Openquery "qryUpdate1"
endif

You could put this code in the Load event of your Startup form, rather than an autoexec macro (although I'm sure there are ways to do If/Then statements in macros, I've never felt the need to learn how).
0

Featured Post

Will your db performance match your db growth?

In Percona’s white paper “Performance at Scale: Keeping Your Database on Its Toes,” we take a high-level approach to what you need to think about when planning for database scalability.

Question has a verified solution.

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

Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
Code that checks the QuickBooks schema table for non-updateable fields and then disables those controls on a form so users don't try to update them.
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

715 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