[AccessD] Trigger code every day

Jim Dettman jimdettman at earthlink.net
Fri Aug 11 07:25:17 CDT 2006


Rocky,

  I'd use the windows scheduler, passing in command line switches if the app
needs to carry out different functions.  It's simple enough and easy to fix
if something doesn't work right.  Plus, just about every flavor of Windows
has some type of scheduler available.

  I have done things the other way too, which is to use an app that is
continually open and checks for events (it was a poller for time clocks).
Basically, I ended up building my own scheduler in Access as I had a
multitude of different events (sync the clocks, back them up, download time
clock data, set the date/time, etc). It worked well and I avoided the
overhead of starting /stopping Access every time something needed to be
done, but everything was wrapped up in the app.  It was something that was
not easy for a end user to control.

  Also, starting/stopping can work in your favor, especially if you trip
over Access bugs. Memory leaks, etc are not a problem because you always
start with a clean slate each time.

  One problem with the task scheduler approach; the thing is not too smart
about starting the same app multiple times.  For example, if your passing in
command line arguments and hence have the same app defined across multiple
schedules (you have multiple task entries), it can get fired off multiple
times.

  To get around this, I wrote some code based on some work I did with VFP
that generates a mutex resource lock as a semaphore flag.  The app fires up,
checks if another instance is running and if so, aborts.  Handy for lots of
things.  I also use it for apps where I want the user to only be allowed one
instance of an app per station.  If they attempt to fire up a second copy, I
tell them that they are already running and copy, and switch focus to it.

I'm willing to share that with the list if anyone wants it.  I've got a
small sample of the poller code as well, but it's not as polished as the
semaphore stuff.

Jim.



-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Rocky Smolin -
Beach Access Software
Sent: Thursday, August 10, 2006 7:45 PM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] Trigger code every day

The app creates the files.  The app is actually my E-Z-MRP system and 
the third party is a company called Healex which makes a product called 
Nocturne.  On a regular basis, in this case daily, the client exports 
files (from whatever manufacturing management system they're using, in 
this case mine) containing their parts, inventory, purchase orders, 
unmet demands, transactions, supplier info, etc. and the Nocturne 
program picks the data off of their server and passes it out to the 
suppliers who get daily updates on what their customer needs in the way 
of raw materials. It's a supply chain management thing. 

And generally it's used by really big companies.  This outfit in 
Shanghai is real small - small enough for E-Z-MRP, but their only 
customer is Phillips - who uses Nocturne themselves.  So Phillips 
insisted that this little company, a captive supplier, use Nocturne as 
well. 

So I wrote a routine inside E-Z-MRP to create these csv files for 
Nocturne and they could trigger the export whenever they wanted.  But of 
course, once they saw how it worked, next thing they wanted was for it 
to be automated to run every day so they wouldn't have to remember to do it.

So there's more than you probably wanted to know.


Rocky


Charlotte Foust wrote:
> The answer is "it depends."  We created a couple of products that run
> like this.  The big gotcha is that it doesn't run as a service, and it
> really isn't a good idea to install Access on a server.  Yes, it sucks
> up cycles, not to mention the fact that when the server goes down, it
> will come back up but your application won't.  The better way is not to
> use Access for the app. 
>
> When you say the app is going to "export some files",  what do you mean?
> Are these files created by the app or by some other application, with
> the desired program just checking for the existence of files and then
> moving them somewhere?
>
> Charlotte Foust
>
> -----Original Message-----
> From: accessd-bounces at databaseadvisors.com
> [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Rocky Smolin
> - Beach Access Software
> Sent: Thursday, August 10, 2006 9:09 AM
> To: Access Developers discussion and problem solving
> Subject: [AccessD] Trigger code every day
>
> Dear List:
>
> A client needs to run a program every day at the same time to export
> some files.  I'm thinking that I use the OnTimer event with some timer
> interval (like 5 minutes) and check the clock to see if it's time to do
> the export.  This app will run all the time in the background and reside
> probably on their server.  Is this going to suck up a lot of server
> cycles?  Is there a better way to do this?
>
> MTIA
>
> Rocky
>
>   

-- 
Rocky Smolin
Beach Access Software
858-259-4334
www.e-z-mrp.com

-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com





More information about the AccessD mailing list