What is the code to allow the user to continue working while code

T

ThriftyFinanceGirl

I know that there should be some code that allows users to do other things on
the pc while the code is running. I have a pretty long process that I would
like for them to be able to do other things (ie. Excel, Email, etc) while the
process is running.
 
J

JimBurke via AccessMonster.com

If your Access appl is running a long process the user should still be able
to do other things on the PC - it shouldn't completely lock everything up.
Are you having a problem where it's locking up the workstation? You should be
able to switch to other windows. I guess if the Access function is entirely
CPU-bound it could do that, but I would think it would involve some
reading/writing of data, which should make it so that other windows can
function.
 
T

ThriftyFinanceGirl

Jim,

it isn't totally holding up the PC, I just thought that there was a specific
command that could be used here. I guess I'm probably doing all that I can
do. We'll see how it goes when we go live!
 
D

Dale Fye

In my humble opinion, DoEvents should be nested inside almost every loop
(Do/Loop, For/Next) within access code.

However, if your "process" involves running an extremely long running query,
then chances are that Access is taking up most of your CPU. If this is the
case, you might want to consider moving your database backend (BE) to SQL
Server or SQL Server Express, and use pass-through queries or stored
procedures to push the workload to a server.
 
J

Jack Leach

If I understand correctly, different versions of access under different
versions of windows will handle CPU load in various ways. Some Access
versions will utilize 100% of CPU usage, where other versions (say on a Vista
Dual or Quad Core processor) will put a cap at a certain percentage.

I'm not positive about this, but I have a vauge recollection of reading
about it in some post or another.

On the other hand, I don't ever recall seeing code to specifically let you
do other things while your process executes. Vice-versa, there is a
ShellWait API that does the exact opposite, but I would think that in order
to do what you are thinking, you would need some pretty serious interaction
with how the OS handles CPU processing (which is something that is far far
over my head, and likely that's true for most people here). And if there was
such code, it would probably vary between OS's. In any case, these seems
like quite the task.

I'm not even positive that DoEvents would have any effect here... I'm not
sure but I suspect that DoEvents yeilds only to the VBA process that's
running, not to every process being handled by the CPU. If such were the
case, DoEvents (VBA) would be required to interact with every running process
on the computer. Consider that your computer is running a virus scan in the
background... I don't think DoEvents would wait until that is complete before
executing the next block of code... therefore my suspicion about DoEvents
working only within the scope of the current VBA project.

If in fact there is code to do this, I'm pretty sure it would invlove some
highly complex API calls working with CPU and memory buffers. This may be
well out of the scope of VBA's capabilities.

--
Jack Leach
www.tristatemachine.com

"I haven''t failed, I''ve found ten thousand ways that don''t work."
-Thomas Edison (1847-1931)
 
S

Stuart McCall

Jack Leach said:
If I understand correctly, different versions of access under different
versions of windows will handle CPU load in various ways. Some Access
versions will utilize 100% of CPU usage, where other versions (say on a
Vista
Dual or Quad Core processor) will put a cap at a certain percentage.

I'm not positive about this, but I have a vauge recollection of reading
about it in some post or another.

On the other hand, I don't ever recall seeing code to specifically let you
do other things while your process executes. Vice-versa, there is a
ShellWait API that does the exact opposite, but I would think that in
order
to do what you are thinking, you would need some pretty serious
interaction
with how the OS handles CPU processing (which is something that is far far
over my head, and likely that's true for most people here). And if there
was
such code, it would probably vary between OS's. In any case, these seems
like quite the task.

I'm not even positive that DoEvents would have any effect here... I'm not
sure but I suspect that DoEvents yeilds only to the VBA process that's
running, not to every process being handled by the CPU. If such were the
case, DoEvents (VBA) would be required to interact with every running
process
on the computer. Consider that your computer is running a virus scan in
the
background... I don't think DoEvents would wait until that is complete
before
executing the next block of code... therefore my suspicion about DoEvents
working only within the scope of the current VBA project.

If in fact there is code to do this, I'm pretty sure it would invlove some
highly complex API calls working with CPU and memory buffers. This may be
well out of the scope of VBA's capabilities.

--
Jack Leach
www.tristatemachine.com

"I haven''t failed, I''ve found ten thousand ways that don''t work."
-Thomas Edison (1847-1931)

Jack

Take a look at this:

http://support.microsoft.com/kb/158175
 

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