View Single Post
Old 11-12-03, 11:29 AM   #10 (permalink)
Ohayden
Aximsite Minor League
 
Ohayden's Avatar
Member
 
Join Date: Jun 2003
Location: http://www.ATechware.com
Posts: 187
Thanked 0 Times in 0 Posts
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.
Ohayden is offline   Reply With Quote