Msgbox flashes on screen

D

Debbie

Hi everyone,
I have an AfterUpdate event on my form and in that event I have the following:

If AppointmentType = 'Routine' then
Resp = MsgBox("Do you want to email?",vbYesNo,"Input Needed!")
If Resp = 7 then
Exit Sub
Else
proceed.....
End if
End if

The problem is that the MsgBox is flashed so quickly on the screen, the user
can barely see it let alone respone to it. How do I temporarily suspend
the execution so that this prompt can be displayed and the user can respond?
Thank you very much.
Debbie
 
K

Ken Snell \(MVP\)

A MsgBox will suspend all code activity until it's dismissed, so it is what
you should be using. Tell us more details about your setup, what is
happening in the database when you want to display the MsgBox, etc.
 
F

fredg

Hi everyone,
I have an AfterUpdate event on my form and in that event I have the following:

If AppointmentType = 'Routine' then
Resp = MsgBox("Do you want to email?",vbYesNo,"Input Needed!")
If Resp = 7 then
Exit Sub
Else
proceed.....
End if
End if

The problem is that the MsgBox is flashed so quickly on the screen, the user
can barely see it let alone respone to it. How do I temporarily suspend
the execution so that this prompt can be displayed and the user can respond?
Thank you very much.
Debbie

What is Resp? It's not declared. Anyway, you don't need it.
Also, the criteria should be placed within double quotes, not single
quotes.

Try:
If [AppointmentType] = "Routine" then
If MsgBox("Do you want to email?",vbYesNo,"Input Needed!") = vbNo
Then
Else
proceed.....
End if
End if
 
D

Debbie

Thank you both for your responses. In terms of how this is used, there are a
couple of fields on the forms that when they are changed, an update flag that
I declared is set to 1 in that text box's AfterUpdate event. In the forms's
AfterUpdate event, the flag is tested. If an update has been set to 1, then
the program checks the appointment type. If the appointment type is
'Routine' then I want a prompt to ask the user if an email should be sent.
If the user repies No, then I want the sub to be exited. If the user
responds Yes, then a procedure I wrote to automatically send an email should
execute.

The variable 'Resp' has been declared to hold the user's reply. I've used
this technique many times in the same way and I don't know why it is not
working here. Thanks so much for any ideas you have.
Debbie

fredg said:
Hi everyone,
I have an AfterUpdate event on my form and in that event I have the following:

If AppointmentType = 'Routine' then
Resp = MsgBox("Do you want to email?",vbYesNo,"Input Needed!")
If Resp = 7 then
Exit Sub
Else
proceed.....
End if
End if

The problem is that the MsgBox is flashed so quickly on the screen, the user
can barely see it let alone respone to it. How do I temporarily suspend
the execution so that this prompt can be displayed and the user can respond?
Thank you very much.
Debbie

What is Resp? It's not declared. Anyway, you don't need it.
Also, the criteria should be placed within double quotes, not single
quotes.

Try:
If [AppointmentType] = "Routine" then
If MsgBox("Do you want to email?",vbYesNo,"Input Needed!") = vbNo
Then
Else
proceed.....
End if
End if
 
J

J_Goddard via AccessMonster.com

Hi -

Might you be using Sendkeys in the code somewhere to "send" an "Enter" by
mistake to the Msgbox, which it interprets as a user response?

John

Thank you both for your responses. In terms of how this is used, there are a
couple of fields on the forms that when they are changed, an update flag that
I declared is set to 1 in that text box's AfterUpdate event. In the forms's
AfterUpdate event, the flag is tested. If an update has been set to 1, then
the program checks the appointment type. If the appointment type is
'Routine' then I want a prompt to ask the user if an email should be sent.
If the user repies No, then I want the sub to be exited. If the user
responds Yes, then a procedure I wrote to automatically send an email should
execute.

The variable 'Resp' has been declared to hold the user's reply. I've used
this technique many times in the same way and I don't know why it is not
working here. Thanks so much for any ideas you have.
Debbie
[quoted text clipped - 26 lines]
End if
End if
 
D

Debbie

John,
No, I definately don't have SendKeys in my code. Can it have somthing to do
with being in an after upate event?
Debbie

J_Goddard via AccessMonster.com said:
Hi -

Might you be using Sendkeys in the code somewhere to "send" an "Enter" by
mistake to the Msgbox, which it interprets as a user response?

John

Thank you both for your responses. In terms of how this is used, there are a
couple of fields on the forms that when they are changed, an update flag that
I declared is set to 1 in that text box's AfterUpdate event. In the forms's
AfterUpdate event, the flag is tested. If an update has been set to 1, then
the program checks the appointment type. If the appointment type is
'Routine' then I want a prompt to ask the user if an email should be sent.
If the user repies No, then I want the sub to be exited. If the user
responds Yes, then a procedure I wrote to automatically send an email should
execute.

The variable 'Resp' has been declared to hold the user's reply. I've used
this technique many times in the same way and I don't know why it is not
working here. Thanks so much for any ideas you have.
Debbie
Hi everyone,
I have an AfterUpdate event on my form and in that event I have the following:
[quoted text clipped - 26 lines]
End if
End if
 
J

J_Goddard via AccessMonster.com

Hi -

In your If [AppointmentType] = 'Routine' statement, (as you have posted
it) 'Routine' is in single quotes; however, if single quotes is your code,
it should not even compile.

I don't see anything wrong in your code; a MsgBox call should always pause
and wait for user input. This type of logic is common for an After Update
event, so I doubt that's it. What After Update event is it in?

John

P.S - Could your user's keyboard have a sticky "Enter" key? Now, that's
REALLY clutching at straws, right? But, hey, it's 1:00 AM - strange things
pop out of brains then.

J.

John,
No, I definately don't have SendKeys in my code. Can it have somthing to do
with being in an after upate event?
Debbie
[quoted text clipped - 23 lines]
 
D

Debbie

John,
Thanks again for your advise. My code does have the double quotes, when I
entered the question I had to do it from memory so my apologies. The enter
key was a good theory, Lord knows stranger things have happened especially at
that hour but we tried it on different computers and the same thing happened.
We are running on Termial Services and I wonder if that has anything to do
with it. I just thought of this and I'm going to ask someone there to try it
while using it locally. Thanks again, I appreciate your help.
Debbie

J_Goddard via AccessMonster.com said:
Hi -

In your If [AppointmentType] = 'Routine' statement, (as you have posted
it) 'Routine' is in single quotes; however, if single quotes is your code,
it should not even compile.

I don't see anything wrong in your code; a MsgBox call should always pause
and wait for user input. This type of logic is common for an After Update
event, so I doubt that's it. What After Update event is it in?

John

P.S - Could your user's keyboard have a sticky "Enter" key? Now, that's
REALLY clutching at straws, right? But, hey, it's 1:00 AM - strange things
pop out of brains then.

J.

John,
No, I definately don't have SendKeys in my code. Can it have somthing to do
with being in an after upate event?
Debbie
[quoted text clipped - 23 lines]
End if
End if
 

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