|
I am calling the funciton below. When I use it I get an error about using the 'Mid' function. This code should run just fine. I have tried it in both a form and a module.
Public Function ChkQty(vQty As String) As Boolean
Dim X As Long
Dim sQty As String
'validate a numeric value
For X = 0 To Len(vQty) - 1
sQty = Mid(vQty, X, 1)
If Asc(vQty) >= 48 And Asc(vQty) <= 57 Then
'no alpha characters
Else
MsgBox "QTY can contain numeric values only!", vbInformation, "Remote Invoice"
ChkQty = False
Exit Function
End If
Next X
ChkQty = True
End Function
|