Do not Show Letters in text field in result of query

caz

Registered User.
Local time
Today, 18:46
Joined
Aug 21, 2004
Messages
12
Hello

I have seen a few example of this but none of them are exactly what I am after. I need to show the road number and not the letter.

Eg ZC1000
or
A13

Desired result

1000
13

The letters are always at the beginning but there could be 1 or 2 or 3

Any possibilities would be gratefull recieved.
 
Try pasting this in a module then
follow the instructions for calling the function.
Code:
Function SaveNumer(ByRef pStr As String) As String
'*******************************************
'Purpose:   Removes alpha characters from
'           a string
'Coded by:  raskew
'Calls:     Function IsNumeric()
'Inputs:    ? SaveNumer(" t#he *qu^i5ck !b@r#o$w&n fo#x ")
'Output:    5
'Note:      As written, empty spaces are ignored.
'*******************************************

Dim strHold As String
Dim intLen  As Integer
Dim n       As Integer

    strHold = Trim(pStr)
    intLen = Len(strHold)
    n = 1
    Do
       If Mid(strHold, n, 1) <> " " And Not IsNumeric(Mid(strHold, n, 1)) Then
          strHold = Left(strHold, n - 1) + Mid(strHold, n + 1)
          n = n - 1
       End If
       n = n + 1
    Loop Until Mid(strHold, n, 1) = ""
    SaveNumer = strHold
    
End Function
HTH - Bob
 
Code:
Public Sub NumbersOnly(ByVal strData As String) As String
    Dim bytCounter As Byte
    For bytCounter = 1 To Len(strData)
        If IsNumeric(Mid(strData, bytCounter, 1)) Then
            NumbersOnly = NumbersOnly & Mid(strData, bytCounter, 1)
        End If
    Next bytCounter  
End Sub
 

Users who are viewing this thread

Back
Top Bottom