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" <APHILLEY (AT) WATSONFURNITURE (DOT) COM> wrote
Quote:
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? |