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
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