Forum

MSGBOX not displayi...
 
Notifications
Clear all

MSGBOX not displaying, Vbyes being automatically selected

2 Posts
2 Users
0 Reactions
92 Views
(@dilipuma200011)
Posts: 3
Active Member
Topic starter
 

Private Sub avgtxt_change()
Application.Wait Now() + TimeValue("00:00:01")
If AvgTxt.TextLength >= 5 Then
If Val(AvgTxt.Value) < Val(frmMV.txtWidthMin.Value) Or Val(AvgTxt.Value) > Val(frmMV.txtWidthMax.Value) Then
Application.Wait Now() + TimeValue("00:00:01")
Dim ans As VbMsgBoxResult
ans = MsgBox("Do You Want to Re-Inspect the Dimension again ?", vbYesNo + vbQuestion, "Dimension Out of Spec")
Application.Wait Now() + TimeValue("00:00:01")
If ans = vbYes Then
Application.Wait Now() + TimeValue("00:00:01")
W1.Text = ""
W2.Text = ""
W3.Text = ""
W4.Text = ""
W5.Text = ""
W1.Enabled = True
W1.SetFocus
ElseIf ans = vbNo Then
frmMV.ActiveControl.Value = frmAvg.AvgTxt.Value
End If

Else

frmMV.ActiveControl.Value = frmAvg.AvgTxt.Value

Exit Sub
End If
End If
End Sub

 
Posted : 01/01/2021 6:20 am
(@catalinb)
Posts: 1937
Member Admin
 

Hi Dilip,

I doubt that VbYes gets selected without displaying the message box.

Make sure that the conditions are met for the MsgBox to be displayed;
If AvgTxt.TextLength >= 5 Then
If Val(AvgTxt.Value) < Val(frmMV.txtWidthMin.Value) Or Val(AvgTxt.Value) > Val(frmMV.txtWidthMax.Value) Then

 
Posted : 02/01/2021 6:02 am
Share: