J
Joe Harman
Yes. The code to get the first name from a pair of names
separated by "&" would look something like this. For
simplicity, the code below uses a variable (str2Srch)
instead of a field name.
Function findstr()
Dim str2Srch As String
Dim strResult As String
Dim intLoc As Integer
' Set up the variable we're going to search
str2Srch = "Joe & Jim"
' Where is the Ampersand located?
intLoc = InStr(1, str2Srch, "&")
' Trim the string to get only the part before
' the ampersand and the space preceeding it and
' put it in strResult.
strResult = Left(str2Srch, intLoc - 2)
' strResult will now contain "Joe"
End Function
separated by "&" would look something like this. For
simplicity, the code below uses a variable (str2Srch)
instead of a field name.
Function findstr()
Dim str2Srch As String
Dim strResult As String
Dim intLoc As Integer
' Set up the variable we're going to search
str2Srch = "Joe & Jim"
' Where is the Ampersand located?
intLoc = InStr(1, str2Srch, "&")
' Trim the string to get only the part before
' the ampersand and the space preceeding it and
' put it in strResult.
strResult = Left(str2Srch, intLoc - 2)
' strResult will now contain "Joe"
End Function