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

    Unanswered: Splitting/Parsing Numbers


    I have a number (a SAP Cost Center) which consists of 10 digits. The first 3 represent a country, the next 2 a location and the last 5 a department. If someone inputs all 10 digits together I need to split them up into 3 + 2 + 5 digits so that I can look up the details. What is the best way of doing this ?.

    TIA Kees

  2. #2
    Join Date
    Apr 2002

    The best way is to face the 10 digits as a string, not as number.
    When defining the fields as text or variables as strings, you can split it into various forms, using string functions, like:

    Left([Field name] or variable, length as long)
    Mid([Field name] or variable, Start position as long, length as long)
    Right([Field name] or variable, length as long)


    Dim Str as string
    Dim Country as string
    Dim Location as String
    Dim Department as String


    Country=left(Str,3) ' Returns 123
    Location=Mid(Str, 4, 2) ' Returns 45
    Department=Right(Str, 5) ' Returns 67890

Posting Permissions

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