Usenet.com

www.Usenet.com

Group Index

Comp Thread Archive from Usenet.com

<-- __Chronological__ --> <-- __Thread__ -->

Re: Select left



Function GetFirstPart(YourString As String) As String
    Dim nPos As Long

    nPos = InStr(YourString, "-")
    GetFirstPart = Left(YourString, nPos)
End Function

You call this function like this:

Dim strFirstPart

strFirstPart = GetFirstPart("ABCD123-TOP")

and strFirstPart would then contain "ABCD123" ...

-- 
Scott McDaniel
CS Computer Software
www.thedatabaseplace.net

"ANDY PHILLEY" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> I am trying to select data from the left of a delimiter.  I have a
> part number like ABCD123-TOP all of the part numbers are like this.  I
> want to select the data to the left of the -.  The kicker is the data
> to the left of the - is not of a standard length.  It might be 5
> characters or 20 but whatever it is I want it.  Any ideas?





<-- __Chronological__ --> <-- __Thread__ -->


Usenet.com



Please check out one of the premium Usenet Newsgroup Service Providers below for access to Usenet.