473,408 Members | 2,052 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

Can you pause execution of code in AfterUpdate event?

In Access 2002, I designed a simple database for our Safety department
to enter results of a survey. There are 41 true/false statements. I
have a main form called frmSurvey with a subform called sbfrmAnswers.
I put an option group (optAnswers) on the subform with buttons for
true or false. To speed entry of the results of the 350+ surveys
we've collected, I put the following code in the AfterUpdate event of
the option group:

With DoCmd
..GoToControl "txtEmpty" 'a text box on frmSurvey that looks invisible
..GoToRecord,,acNext
..GoToControl "sbfrmAnswers"
..GoToControl "optAnswers"
End With

This works perfectly and you can enter the results of a survey in no
time, but it goes so fast the data entry clerk can't see that she
clicked the correct button. Is there any way to pause the execution
of the code above after the focus gets to txtEmpty so she can look at
optAnswers and verify that she clicked the correct button?

TIA,
JD
Nov 13 '05 #1
3 2903
jd****@yahoo.com (jd****@yahoo.com) wrote in message news:<75**************************@posting.google. com>...
In Access 2002, I designed a simple database for our Safety department
to enter results of a survey. There are 41 true/false statements. I
have a main form called frmSurvey with a subform called sbfrmAnswers.
I put an option group (optAnswers) on the subform with buttons for
true or false. To speed entry of the results of the 350+ surveys
we've collected, I put the following code in the AfterUpdate event of
the option group:

With DoCmd
.GoToControl "txtEmpty" 'a text box on frmSurvey that looks invisible
.GoToRecord,,acNext
.GoToControl "sbfrmAnswers"
.GoToControl "optAnswers"
End With

This works perfectly and you can enter the results of a survey in no
time, but it goes so fast the data entry clerk can't see that she
clicked the correct button. Is there any way to pause the execution
of the code above after the focus gets to txtEmpty so she can look at
optAnswers and verify that she clicked the correct button?


You could do something like the following...

Declare a module level variable in the form's General declarations
section to store the subject's answer:

Dim mintPrevAnswer as Integer

In the AfterUpdate event store the subject's answer:

mintPrevAnswer = optAnswer.OptionValue

and then put a label control on the form, e.g. lblPrevAnswer to
display that answer in the form's Current event:

lblPrevAnswer.Caption = "Your answer to the previous question was " &
mintPrevAnswer

Bruce
Nov 13 '05 #2
jd****@yahoo.com (jd****@yahoo.com) wrote in message news:<75**************************@posting.google. com>...
In Access 2002, I designed a simple database for our Safety department
to enter results of a survey. There are 41 true/false statements. I
have a main form called frmSurvey with a subform called sbfrmAnswers.
I put an option group (optAnswers) on the subform with buttons for
true or false. To speed entry of the results of the 350+ surveys
we've collected, I put the following code in the AfterUpdate event of
the option group:

With DoCmd
.GoToControl "txtEmpty" 'a text box on frmSurvey that looks invisible
.GoToRecord,,acNext
.GoToControl "sbfrmAnswers"
.GoToControl "optAnswers"
End With

This works perfectly and you can enter the results of a survey in no
time, but it goes so fast the data entry clerk can't see that she
clicked the correct button. Is there any way to pause the execution
of the code above after the focus gets to txtEmpty so she can look at
optAnswers and verify that she clicked the correct button?


Yes. Create a second form (frmOptionSelected) with a label control on
it (lblSelected). In the load event of frmOptionSelected put the line

lblSelected.Caption = "You selected option " &
forms!frmSurvey!optAnswers

In the Timer event of frmOptionSelected put the line

DoCmd.Close

Set the Timer Interval property of frmOptionSelected to 1000. Now, on
frmSurvey change the optAnswer AfterUpdate code to

With DoCmd
.OpenForm "frmOptionSelected", , , , , acDialog ' pause, display sel.
option
.GoToControl "txtEmpty" 'a text box on frmSurvey that looks invisible
.GoToRecord,,acNext
.GoToControl "sbfrmAnswers"
.GoToControl "optAnswers"
End With

This will open a form which will display the option that the user
selected and will pause the execution of your optAnswer AfterUpdate
code. It will stay on the screen for one second and then close
automatically allowing your optAnswer AfterUpdate code to continue.
If you want it to pause for shorter or longer periods of time, modify
frmOptionSelected's Timer interval property. You'll probably also
want to make some cosmetic changes to frmOptionSelected to get rid of
the control box, record selectors, navigation bar, caption bar, etc.

HTH,
Bruce
Nov 13 '05 #3
br***@aristotle.net (Bruce) wrote in message news:<d3**************************@posting.google. com>...
jd****@yahoo.com (jd****@yahoo.com) wrote in message news:<75**************************@posting.google. com>...
In Access 2002, I designed a simple database for our Safety department
to enter results of a survey. There are 41 true/false statements. I
have a main form called frmSurvey with a subform called sbfrmAnswers.
I put an option group (optAnswers) on the subform with buttons for
true or false. To speed entry of the results of the 350+ surveys
we've collected, I put the following code in the AfterUpdate event of
the option group:

With DoCmd
.GoToControl "txtEmpty" 'a text box on frmSurvey that looks invisible
.GoToRecord,,acNext
.GoToControl "sbfrmAnswers"
.GoToControl "optAnswers"
End With

This works perfectly and you can enter the results of a survey in no
time, but it goes so fast the data entry clerk can't see that she
clicked the correct button. Is there any way to pause the execution
of the code above after the focus gets to txtEmpty so she can look at
optAnswers and verify that she clicked the correct button?


Yes. Create a second form (frmOptionSelected) with a label control on
it (lblSelected). In the load event of frmOptionSelected put the line

lblSelected.Caption = "You selected option " &
forms!frmSurvey!optAnswers

In the Timer event of frmOptionSelected put the line

DoCmd.Close

Set the Timer Interval property of frmOptionSelected to 1000. Now, on
frmSurvey change the optAnswer AfterUpdate code to

With DoCmd
.OpenForm "frmOptionSelected", , , , , acDialog ' pause, display sel.
option
.GoToControl "txtEmpty" 'a text box on frmSurvey that looks invisible
.GoToRecord,,acNext
.GoToControl "sbfrmAnswers"
.GoToControl "optAnswers"
End With

This will open a form which will display the option that the user
selected and will pause the execution of your optAnswer AfterUpdate
code. It will stay on the screen for one second and then close
automatically allowing your optAnswer AfterUpdate code to continue.
If you want it to pause for shorter or longer periods of time, modify
frmOptionSelected's Timer interval property. You'll probably also
want to make some cosmetic changes to frmOptionSelected to get rid of
the control box, record selectors, navigation bar, caption bar, etc.

HTH,
Bruce


Thanks, Bruce. Yesterday I came up with something very similar to
this. In the On Got Focus event of txtEmpty, I put the code
DoCmd.OpenForm "frmInvisible", , , , , acDialog. I modified the
properties of this form so that it's practically invisible and put a
one second timer on it. Thanks for your reply.
Nov 13 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

19
by: C# Learner | last post by:
What's a nice way to create a non-blocking pause in execution? Will I need to use some kind of timer for this, or is there a nicer way?
8
by: Wim | last post by:
My GUI application starts a process (a console program) when the user hits Play. I would like to add an option to pause that process. The code I've added to detect if the user hit pause/unpause...
2
by: Dave | last post by:
I have a program that I need the program to temporarly stop and wait for a response from a piece of equipment. After a set period I want the program to continue. Like below --execute lline...
18
by: Frank | last post by:
I'm using Sleep(100) and that works OK. However, it would be better if my app continued to receive and process keyboard messages. How can I pause the execution of code in one routine while...
0
by: steveyjg | last post by:
I'm trying to call a function that will pause execution for 30 seconds and have a counter timer counting to 30 seconds during this pause. When the counter hits 30 execution of the program will...
0
dima69
by: dima69 | last post by:
Somtimes we need to run some code asynchronously. I'll explain this by example. Suppose you have a listbox and you need to perform some action in the listbox AfterUpdate event procedure. But the...
11
nathj
by: nathj | last post by:
Hi, I have a strange problem, my code is running too quickly. Allow me to explain (if I can). I am using the XMLHTTP object in order to query the database as a user completes the membership...
4
by: bcallnan | last post by:
Hello All- I am trying to reference a subform's afterupdate event that is 3 deep and am having some trouble getting it to work. The control is a combo box and i cannot seem to trigger the...
3
by: jonceramic | last post by:
Hi all, I have a form with a sub1 and a sub2. Most everything is working right. Except this. I have a "beforeupdate" and an "afterupdate" event on form sub2. "BeforeUpdate" works great. ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.