Schedule a query to run automatically

G

Guest

Is there a way to automate the running of an Access Query?
I would like to schedule this "job" (query) to run automatically every
Monday morning at 7:00. Can I do that in Access?
Thanks
 
A

arthurjr07

Is there a way to automate the running of an Access Query?

i guess, you have to create an exe from VB6 and wrap that Query
in that exe and put it in the sceduled task.

Here is a sample code.
You have to add a reference to Microsoft ActiveX data Object.
Sub Main()
Dim con As New ADODB.Connection
con.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=C:\...\Dbase.mdb;Persist Security Info=False"
con.Execute "SQL Statement"
Set con = Nothing
End Sub

then compile this code and
put the exe to the scheduled task.

Go to START>All programs>Accessories>
System tools>Scheduled task.

hope this will help.
 
J

John Nurick

Hello Jim,

One way is to use the DAO_Execute.vbs script at
http://www.j.nurick.dial.pipex.com/Code/index.htm. Use the Windows task
scheduler to run it at the desired times.

This will work with most action queries. The exception is queries that
use Access-specific features (e.g. getting parameters from forms, or
using custom VBA functions) beyond what's in the Jet database engine
(which understands most built-in VBA functions).
 

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