Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 2002

    Question Unanswered: Change ZZ9999 to 9999 (trim text characters)

    I need to modify a text field that has values like: A512, DB95515, M52, etc. to read just the numeric characters. ie; 512, 95515, 52.

    The problem I'm having is the fact that some are only 3 characters long and some are 8. Some have only one letter prefix and some have two.

    Any ideas?

  2. #2
    Join Date
    Nov 2001
    Try function below:

    Public Function GetNumbers(ByVal strString As String) As String

    Dim strStr As String
    Dim nI As Integer

    GetNumbers = ""
    For nI = 1 To Len(strString)
    strStr = Mid(strString, nI, 1)
    If strStr >= "0" And strStr <= "9" Then
    GetNumbers = GetNumbers & strStr
    End If

    End Function


    msgbox GetNumbers("ZZ456782")


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts