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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Set a task to start an access subroutine

Status
Not open for further replies.

valmatic

IS-IT--Management
Mar 30, 2006
14
US
Hi. Does anyone know of a way to call a subroutine within access from outside of access? I currently have an on-click event that sends out a series of net sends to my network users based on timeliness of an entry into the table. I would like to automate the event so that it runs weekly (or more often). I was thinking I could associate it with a Windows task somehow? The event will be run from a single machine but Access may or may not be open at the time of the send, if that makes any difference in the programming.

thanks,
Josh
 
You may consider the windows Task Scheduler launching your access app with the /x switch.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Thanks for the tips. I'll look at HAL for sure but if I can do it through the task scheduler, even better.

I can't find any help on using the /x switch though and I can't figure out how to open the subroutine through a task. Could you provide an example? Here's the path to my database:

"C:\Program Files\Microsoft Office\Office\MSACCESS.EXE" "C:\Documents and Settings\joshf\My Documents\CAPAlog.mdb" /WRKGRP "C:\Documents and Settings\joshf\My Documents\Secured.mdw"

thanks :)
 
Create a macro named, say, scheduled that run your function.
Then launch the app like this:
"C:\Program Files\Microsoft Office\Office\MSACCESS.EXE" "C:\Documents and Settings\joshf\My Documents\CAPAlog.mdb" /WRKGRP "C:\Documents and Settings\joshf\My Documents\Secured.mdw" /x scheduled

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Wow, that works great. Thanks so much. One last question:

Any idea how to bypass Access security and just run the code? I set up the task scheduler to run the macro through my mdw file and it works fine except the user has to log in to the secured database first. Once logged in, the code runs right away. I'm even getting hit with a login prompt if I have the database already open too though.

It will definitely fly as is but I know the user in question will complain about the extra step lol.

Again thanks.
 
You may try something like this:
"C:\Program Files\Microsoft Office\Office\MSACCESS.EXE" "C:\Documents and Settings\joshf\My Documents\CAPAlog.mdb" /user UserName /pwd Password /WRKGRP "C:\Documents and Settings\joshf\My Documents\Secured.mdw" /x scheduled

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 

Worked like a charm... Thanks a bunch for the help PHV :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top