Wrox Home  
Search P2P Archive for: Go

  Return to Index  

access thread: check textbox for integer (rev.2)


Message #1 by "eindre lucynier" <centurion99@h...> on Wed, 27 Mar 2002 08:19:28
My main objective is to validate the textbox for any numeric data...
txtBox objective to enter "user name"

If IsNumeric([txtBox]) Then
   'data of (hello 7world) returns False
End If

Ques:
   I want to detect the '7' and return true for any invalid entry.
Message #2 by "Phillip Johnson" <phillip.johnson@e...> on Wed, 27 Mar 2002 09:33:44
Try something like:

dim intCount as integer
dim strString as string

For intCount = 0 to (len([txtBox])-1)

    strString = Right([txtBox], len([txtBox])-intCount)
    If IsNumeric(Left(strString, 1)) then
             '   processing here
    End If

Next intCount

I think it will work.

Kind regards, Phillip


> My main objective is to validate the textbox for any numeric data...
t> xtBox objective to enter "user name"

> If IsNumeric([txtBox]) Then
 >   'data of (hello 7world) returns False
E> nd If

> Ques:
 >   I want to detect the '7' and return true for any invalid entry.
Message #3 by ProDev <prodevmg@y...> on Wed, 27 Mar 2002 06:17:57 -0800 (PST)
--0-608386598-1017238677=:53655
Content-Type: text/plain; charset=us-ascii


The code below worked for me. I hope this is what you are looking for...
Private Sub Check4Nums_Click()
Dim intLen As Integer
Dim intCnt As Integer
Dim strChar As String
intLen = Len(MyField)
intCnt = 0
Do While intCnt < intLen   'Check each position
intCnt = intCnt + 1
strChar = Mid(MyField, intCnt, 1)
If Asc(strChar) > 47 And Asc(strChar) < 58 Then 'Checks to see if the character is numberic

'Do something right here

Exit Sub

End If

Loop
End Sub

  eindre lucynier <centurion99@h...> wrote: My main objective is to validate the textbox for any numeric data...
txtBox objective to enter "user name"

If IsNumeric([txtBox]) Then
'data of (hello 7world) returns False
End If

Ques:
I want to detect the '7' and return true for any invalid entry.

Lonnie Johnson, ProDev, Builders of MS Access Databases
Let us build your next MS Access database application. 
http://www.galaxymall.com/software/PRODEV 

Send and Receive payments for free with PayPal:  http://www.paypal.com/refer/pal=Y6TYF7YF8E2JG


---------------------------------
Do You Yahoo!?
Yahoo! Movies - coverage of the 74th Academy Awards®

  Return to Index