Prevent macro or code from running until a condition is met

R

Richardson

I have run across a very strange situation, and I hope someone has a
suggestion.
I have a form that is an invoice. The details of the invoice are in a
subform. I have macros/code that run after each entry in the subform to
update the total line in the main form. These are working great. I have
navigation buttons in the main form that allow the user to move to new
invoices, etc. These also include code to check for errors, validate
entries, and some other stuff.
The database is running in Access runtime (2002 file format) on a machine
that is exceptionally slow.
The problem is that the machine is so slow that users can enter a line in
the subform, the system begins recalculating the total, and before it
finishes running that recalculation macro, the user is able to click on the
navigation buttons at the bottom.
As soon as they trigger the code in the navigation button, the program shuts
down due to errors since the recalculation is still running. I have tested
this extensively, and I only have the problem on this slow machine.
Is there anything I can add to the navigation button code/macro to keep it
from running until all other macros/code on the form finish?

Thanks,
Lori
 
G

Guest

Hi Lori

You might want to try running the Hourglass to give the user a clue the computer is busy
DoCmd.Hourglas

You might also want to make the visible properties of other command buttons false until after the calculations have finished. On faster processing machines, you might not notice that the buttons 'blink'

ht

rp


----- Richardson wrote: ----

I have run across a very strange situation, and I hope someone has
suggestion
I have a form that is an invoice. The details of the invoice are in
subform. I have macros/code that run after each entry in the subform t
update the total line in the main form. These are working great. I hav
navigation buttons in the main form that allow the user to move to ne
invoices, etc. These also include code to check for errors, validat
entries, and some other stuff
The database is running in Access runtime (2002 file format) on a machin
that is exceptionally slow
The problem is that the machine is so slow that users can enter a line i
the subform, the system begins recalculating the total, and before i
finishes running that recalculation macro, the user is able to click on th
navigation buttons at the bottom
As soon as they trigger the code in the navigation button, the program shut
down due to errors since the recalculation is still running. I have teste
this extensively, and I only have the problem on this slow machine
Is there anything I can add to the navigation button code/macro to keep i
from running until all other macros/code on the form finish

Thanks
Lor
 
G

Guest

Just some additions to the suggestion.

----- rpw wrote: -----

Hi Lori,

You might want to try running the Hourglass to give the user a clue the computer is busy?
DoCmd.Hourglass True 'turns the hourglass on
(the rest of your instructions)
DoCmd.Hourglass False 'turns it off at the end of your code

You might also want to make the visible properties of other command buttons false until after the calculations have finished, just so that the user can't click on them. On faster processing machines, you might not notice that the buttons 'blink'.

hth

rpw



----- Richardson wrote: -----

I have run across a very strange situation, and I hope someone has a
suggestion.
I have a form that is an invoice. The details of the invoice are in a
subform. I have macros/code that run after each entry in the subform to
update the total line in the main form. These are working great. I have
navigation buttons in the main form that allow the user to move to new
invoices, etc. These also include code to check for errors, validate
entries, and some other stuff.
The database is running in Access runtime (2002 file format) on a machine
that is exceptionally slow.
The problem is that the machine is so slow that users can enter a line in
the subform, the system begins recalculating the total, and before it
finishes running that recalculation macro, the user is able to click on the
navigation buttons at the bottom.
As soon as they trigger the code in the navigation button, the program shuts
down due to errors since the recalculation is still running. I have tested
this extensively, and I only have the problem on this slow machine.
Is there anything I can add to the navigation button code/macro to keep it
from running until all other macros/code on the form finish?

Thanks,
Lori
 
R

Richardson

Thank you for the suggestions.
I already have the hourglass working, but my users ignore it.
I will try making the command buttons invisible during the calculation. I
think that might be enough to slow them down

Lori


rpw said:
Just some additions to the suggestion.

----- rpw wrote: -----

Hi Lori,

You might want to try running the Hourglass to give the user a clue the computer is busy?
DoCmd.Hourglass True 'turns the hourglass on
(the rest of your instructions)
DoCmd.Hourglass False 'turns it off at the end of your code

You might also want to make the visible properties of other command
buttons false until after the calculations have finished, just so that the
user can't click on them. On faster processing machines, you might not
notice that the buttons 'blink'.
 

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