Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

automatically running an update query

Status
Not open for further replies.

benzan

Technical User
Aug 29, 2007
20
US
i've been trying to figure out a way to run an update query at 2am every day. is this possible? if so how?
thx in advance.
 
Im trying the method that's explained in the post you have requested but im quite confused.

im trying to follow this method.

Step 1.
Create a macro that will run your report using the actions "OutputTo" and "Quit".
When you select the OutputTo action format, file-and-path, and encoding, etc., be sure to set AutoStart to "NO"
When you select the Quit action, choose "EXIT" from its options.

Step 2.
Create a batch file (anyname.bat) with wordpad in the same directory as your database file containing the following information. Be sure that the info on the lines beginning with "path" and "start" does not word-wrap to a second line(turn off word-wrap).

c: (or drive name where your application resides)

path = %PATH%;<drive name>:\windows\command;<drive name>:\<path to your database file's location>;<drive name>:\<path to your msaccess.exe file>

start /wait msaccess.exe "<drive name>:\<path to your database file's location>\<your database file name>" /x "<name of Macro that will run your report>"

exit

Step 3.
Using whichever form of scheduler you have, set it up to call the batch file as often as needed.

You can test the batch file by clicking on it in the windows directory. The scheduler will give you an option to manually test the file as well.

my files are located in our server.
\\pac0031\Public\shk\Budget Mon v.C

pac is the server and public\shk are folders and budmon is the exe file.

 
first of all, im not sure about the drive name and path..
so i moved it to my desktop to test out the batch file.
it seems like it's doing something but I don't see how this method runs the updqte query.
doest this thing only output data to a text file?
 
I'm confused though when you say it's budmon.exe...Databases don't have exe extensions.

You need to modify step one somewhat so that when your macro is run it runs your update query and then quits.

The batch file runs the macro that you created in the first step which runs the update query you developed. Since you will be running the batch file on the server, you need to find out what the drive location is for that server and file location so that you can add that to the example above. You'll need to find out what kind of scheduler is available to run the batch file on the server too.

HTH

Leslie
 
im not sure what i have is correct...

c:

path = %PATH%;<c>:\windows\command;<\\pac0031>:\<\\pac0031\public\shk>;<c>:\<C:\Program Files\Microsoft Office\OFFICE11>

start /wait msaccess.exe "<\\pac0031>:\<\\pac0031\public\shk>\<Budget Monitor v.I>" /x "<autoRunQuery>"

it seems like it's working.. i've checked the bat file and i think all the data are correctly outputted. The thing i don't understand is how does this actually update my data? i need to run the update query to update the budget but all this does is output the data.. am i missing something?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top