exbox,
I can tell you come from a "C" background ;). eVB is not zero based and strings (TCHARS) are one based. In your "for loop" you're starting at zero, you need to start at one as follows:
I optimized your function for you plus fixed a bug. You set sQty but used vQty instead :).
|
Code:
|
Public Function ChkQty(vQty As String) As Boolean
Dim X As Long
Dim sQty As String
'validate a numeric value
ChkQty = True ' DEFAULT TO TRUE
For X = 1 To Len(vQty)
sQty = Mid(vQty, X, 1)
If Asc(sQty) < 48 Or Asc(sQty) > 57 Then
MsgBox "QTY can contain numeric values only!", vbInformation, "Remote Invoice"
ChkQty = False
Exit For
End If
Next X
End Function |
Regards,
__________________
Ohayden,
Axim X30
Pocket PC Software:
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Last edited by Ohayden; 11-12-03 at 11:34 AM.
|