Thread Programming - Background Processes

G

Guest

I have several functions that I would like to run periodically as a user is
using my front-end. Specifically, I have a function that is run whenever a
form loads that will check to see if there is a new version available on the
network, or if the admin wants everyone to quit the application, etc. Not
too important. Either way, running this as a thread would work much better.
In pseudocode, this is what I'd like to do:

Start Thread1
Loop
if new version available then
start Thread2(2 minutes)
notify user
end if
Check for lockout
start Thread2(1 minute)
notify user
end if
wait 3 minutes
end loop
End Thread1

Start Thread2(X as integer)
Wait for X Minutes
Quit program
End Thread2


Basically what happens is every 3 minutes a check will run to see if there's
a new update available or if the admin wants to lock out the database (for
editing the back end tables, mainly).

If there is a new update available, a message box will tell the user that an
update is available, and that the program will automatically shut down in 2
minutes if they do not. When the user starts up the database again (via a
launcher executable) it will autotomatically download the new update.

If the admin wants to lock out the database (it's a yes/no value in a
table), the user will be notified with a message box and the front end will
close within 1 minute if they do not. The front-end will pop a message box
and automatically shut down if the user tries to log in.

I know it's a stretch to suggest that VBA can create and run thread
processes. But hell, it might be possible, so I'm throwing it out there.
Basically, I would like to learn how to run a thread, or how to fake one.

Thanks!

Nick
 
L

Larry Daugherty

Usually, one would only check for a new version of the FrontEnd at
session initiation. See FE Updater on Tony Toews' site.

Access is inherently multi-user. That means that many users can be
editing data in the tables in the BackEnd. That's the way it's
supposed to work. No need to get out unless there is some kind of
massive purge and reload going on. In that case, there is code
available to simply kick everyone off. Then Admin can open the
BackEnd exclusively and do the deed.

If there's something you want to do at a timed interval, set a timer
on a form. Hide that form rather than closing it. At the specified
interval, the timer will fire and you will be taken to your code. If
you have multiple timed loops, use multiple forms with timers. Life
could get interesting! Many things in Access are already
asynchronous. Developers are cautioned to place the DoEvents command
inside tight loops so that Access can do other things.

HTH
 

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

Similar Threads


Top