Msgbox delayed using AFTERUPDATE

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Please help

I have used various afterupdate commands in VB to enable fields and
change the background colour of fields when specific things happen to
fields.

My problem is that I have added a "msgbox..." with a yes-no option in
the afterupdate code BUT the msgbox doesn't appear until the I click the
mouse on another field or on the form itself.

What am I missing to make the popup display straight away.

I can't use _change as the msgbox pops up when the field is populated
when the details are first returned. And, beforeupdate doesn't make any
difference.

cheers
Aaron

Private Sub cbCurrent_AfterUpdate(ByVal Cancel As MSForms.ReturnBoolean)
'=======================================================================
==
'Transfers information from the clients record to the history screens
when
'the client becomes current again
'=======================================================================
==
If cbCurrent = "Yes" Then

'Present a confirmation box
Dim Msg2, Style2, Title2, Help2, Ctxt2, Response2, vConfirm2
Msg2 = "Do you want to create a history record for the youth? (A
history record is not required if this is the first time the youth will
be current)" ' Define message.
Style2 = vbYesNo + vbCritical + vbDefaultButton2
' Define buttons.
Title2 = "Please confirm"
' Define title.
Help2 = "DEMO.HLP"
' Define Help file.
Ctxt2 = 1000

'Record response
Response2 = MsgBox(Msg2, Style2, Title2, Help2, Ctxt2)

'Check if Yes or No
If Response2 = vbYes Then ' User chose
Yes

If tbHistRefDate1 = "" Then
tbHistRefDate1 = tbRefDate
tbHistRefSource1 = cbRefSource
 
Your asking for an event to know when you have finished entering data. It
knows this when you exit the textbox. Other than that, you would have to
trap a specific keystroke with one of the key events.
 
Hi Tom (Not sure if you will see this - but hopefully)

I understand what you are saying, but it is the inclusion of the msgbox
text that is causing the delay.

I have numerous other afterupdates that kick in as soon as the user (me)
makes a selection from the "combo box". I can apply what you are saying
to a text box where the system would need a "hey I'm finished updating
that box", like tabbing to the next box.

BUT: as I said, it's a combo-box and the afterupdate should trigger when
I click on a selection (Yes/No_ like all the others do. The only
difference is the inclusion of the msgbox.

cheers
Aaron
 
only indication you were talking about a combobox was the fact the name
started with cb. Everything else sounded like a textbox.

comment out the msgbox code. Does it work as expected then.

I would expect to see no difference. I tested a combobox with and without
a message box and in both cases After_Update didn't fire until after focus
had left the combobox. I can't explain the different experience you have
had.
 
Hi Tom

your dead right, i was using _change for most of the other boxes.

cheers
Aaron
 

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

Back
Top