• in both vb6 or VB.Net, you can split the string into elements, and take the first element, or you can use the built in string functions.

    'VB.Net: both return "ABC"

    Dim SomeString As String = "ABC DEF GHI"

    Dim val = SomeString.Substring(0, SomeString.IndexOf(" "))

    Dim arr() As String = "ABC DEF GHI".Split(" ")

    val = arr(0)

    'VB6

    Dim SomeString As String

    SomeString = "ABC DEF GHI"

    Dim val As String

    val = Left(SomeString, InStr(SomeString, " ") - 1) '-1 to remove the space

    Dim arr() As String

    arr = Split("ABC DEF GHI", " ")

    val = arr(0)

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!