ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Msgbox delayed using AFTERUPDATE (https://www.excelbanter.com/excel-programming/322797-msgbox-delayed-using-afterupdate.html)

No spam please

Msgbox delayed using AFTERUPDATE
 
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




*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Tom Ogilvy

Msgbox delayed using AFTERUPDATE
 
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.


--
Regards,
Tom Ogilvy


"No spam please" wrote in message
...
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




*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!





All times are GMT +1. The time now is 02:09 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com