Hi:
I am running some data validation dealing with tolerances. For example:
Private Sub txtElongation_BeforeUpdate(Cancel As Integer)
Dim MinElong As Double, MaxElong As Double
Select Case Me.cboWireSize
Case "0.172": MinElong = 10: MaxElong = 40
Case "0.175": MinElong = 10: MaxElong = 40
Case "0.182": MinElong = 15: MaxElong = 35
Case "0.200": MinElong = 10: MaxElong = 40
Case "0.209": MinElong = 15: MaxElong = 35
Case "0.227": MinElong = 15: MaxElong = 35
Case "0.270": MinElong = 15: MaxElong = 35
Case "0.330": MinElong = 15: MaxElong = 35
End Select
If Me.txtElongation < MinElong Or Me.txtElongation > MaxElong Then
MsgBox "The elongation is out of spec. Please see that your entry is correct, otherwise PLACE THIS REEL ON HOLD!!", _
vbCritical, "ELONGATION OUT OF SPEC."
Cancel = True
End If
End Sub
When the user makes a selection from cboWireSize that ends in a zero, like 0.200 or 0.330, and then enter data in txtMeasuredDiameter, they get the OUT OF SPEC!! msgbox even if what they entered was correct.
I think this is a formatting issue but am not sure. Any help would be greatly appreciated. Thanks a lot.
I am running some data validation dealing with tolerances. For example:
Private Sub txtElongation_BeforeUpdate(Cancel As Integer)
Dim MinElong As Double, MaxElong As Double
Select Case Me.cboWireSize
Case "0.172": MinElong = 10: MaxElong = 40
Case "0.175": MinElong = 10: MaxElong = 40
Case "0.182": MinElong = 15: MaxElong = 35
Case "0.200": MinElong = 10: MaxElong = 40
Case "0.209": MinElong = 15: MaxElong = 35
Case "0.227": MinElong = 15: MaxElong = 35
Case "0.270": MinElong = 15: MaxElong = 35
Case "0.330": MinElong = 15: MaxElong = 35
End Select
If Me.txtElongation < MinElong Or Me.txtElongation > MaxElong Then
MsgBox "The elongation is out of spec. Please see that your entry is correct, otherwise PLACE THIS REEL ON HOLD!!", _
vbCritical, "ELONGATION OUT OF SPEC."
Cancel = True
End If
End Sub
When the user makes a selection from cboWireSize that ends in a zero, like 0.200 or 0.330, and then enter data in txtMeasuredDiameter, they get the OUT OF SPEC!! msgbox even if what they entered was correct.
I think this is a formatting issue but am not sure. Any help would be greatly appreciated. Thanks a lot.