By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
428,586 Members | 623 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 428,586 IT Pros & Developers. It's quick & easy.

Can you pause execution of code in AfterUpdate event?

P: n/a
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
Share this Question
Share on Google+
3 Replies


P: n/a
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

P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.