You could write a little parser function. below is some psuedo code.. It is most likely not the optimal was, but I think it works... hthw,
Function Testit()
Dim lcField1 As String
Dim lcField2 As String
Dim lcField3 As String
Dim lcString As String
Dim lcDelimiter As String
lcString = "field1,field2,field3"
lcDelimiter = ","
lcField1 = ParseData(lcString, lcDelimiter, 1)
lcField2 = ParseData(lcString, lcDelimiter, 2)
lcField3 = ParseData(lcString, lcDelimiter, 3)
End Function
Function ParseData(lcStr As String, lcDelim As String, lnPos As Integer) As String
Dim lcField As String
Dim lnStartPos As Integer
Dim lnEndPos As Integer
Dim lnEndPosLast As Integer
Dim lnLength As Integer
Dim lnDelimPos As Integer
'"field1,field2,field3"
'Get Start/End Positions
lnEndPosLast = 0
lnDelimPos = 1
lnStartPos = 1
For ICnt = 1 To lnPos
lnEndPos = InStr(lnEndPosLast + 1, lcStr, lcDelim)
If lnEndPos = 0 Then
lnStartPos = lnEndPosLast + 1
lnEndPos = Len(lcStr) + 1
Exit For
Else
If ICnt = lnPos Then
lnStartPos = lnEndPosLast + 1
Exit For
End If
End If
lnEndPosLast = lnEndPos
Next ICnt
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.