Hi, I'm trying to parse a field that has a delimiter and different numbers of words into seperate fields. The input file had two different delimiters, "," and "|", so I imported with the comma delimeter, but now I'm trying to split out the fields between the |'s.
I found some code on a site to parse out the delimiters, but can't seem to get the field name to update to the correct number.
Becuase there may be 1 to 100 different pieces to parse, I've created the table with all the fields:
s1
r1
s2
r2
s3
r3
etc. up to 50. The field has a service type then a rate type. Here is a piece of the code I have:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
strAString = rs1!info
Do While rs1.EOF = False
With rs2
.AddNew
rs2!COMPANY = rs1!COMPANY
rs2!AGNT = rs1!AGNT
rs2!PKG = rs1!PKG
rs2!Description = rs1!Description
End With
'Now call the other function to retrieve each one in turn
For I = 1 To intCnt
rsSI = "rs2!s" & I
rsRI = "rs2!r" & I
stWord = GetCSWord(strAString, I)
' Debug.Print GetCSWord(strAString, I)
If Left(stWord, 1) = "$" Then
With rs2
rsRI = stWord
End With
Else
rsSI = stWord
End If
rs2.Update
Next
rs1.MoveNext
strAString = rs1!info
Loop
rs1.Close
rs2.Close
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
The problem I'm have is with these lines:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
rsSI = "rs2!s" & I
rsRI = "rs2!r" & I
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
and
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
If Left(stWord, 1) = "$" Then
With rs2
rsRI = stWord
End With
Else
rsSI = stWord
End If
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
It won't let me increment the field name by one to pick the next parsed word. Do I have to code in all 100 fields?
Any help would be appreciated. Thanks.
"One Database to rule them all, One Database to find them,
One Database to bring them all and in the darkness bind them."
I found some code on a site to parse out the delimiters, but can't seem to get the field name to update to the correct number.
Becuase there may be 1 to 100 different pieces to parse, I've created the table with all the fields:
s1
r1
s2
r2
s3
r3
etc. up to 50. The field has a service type then a rate type. Here is a piece of the code I have:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
strAString = rs1!info
Do While rs1.EOF = False
With rs2
.AddNew
rs2!COMPANY = rs1!COMPANY
rs2!AGNT = rs1!AGNT
rs2!PKG = rs1!PKG
rs2!Description = rs1!Description
End With
'Now call the other function to retrieve each one in turn
For I = 1 To intCnt
rsSI = "rs2!s" & I
rsRI = "rs2!r" & I
stWord = GetCSWord(strAString, I)
' Debug.Print GetCSWord(strAString, I)
If Left(stWord, 1) = "$" Then
With rs2
rsRI = stWord
End With
Else
rsSI = stWord
End If
rs2.Update
Next
rs1.MoveNext
strAString = rs1!info
Loop
rs1.Close
rs2.Close
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
The problem I'm have is with these lines:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
rsSI = "rs2!s" & I
rsRI = "rs2!r" & I
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
and
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
If Left(stWord, 1) = "$" Then
With rs2
rsRI = stWord
End With
Else
rsSI = stWord
End If
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
It won't let me increment the field name by one to pick the next parsed word. Do I have to code in all 100 fields?
Any help would be appreciated. Thanks.
"One Database to rule them all, One Database to find them,
One Database to bring them all and in the darkness bind them."