davesmith202
Employee of Access World
- Local time
- Today, 02:39
- Joined
- Jul 20, 2001
- Messages
- 522
I have some code that loops to parse some data. To get the data into a table, do I use Recordsets?
Is it easier to parse the data into a string, use split and then cycle that array to push the data into a table? Or perhaps do it on the fly when looping through my parsing code?
Is it easier to parse the data into a string, use split and then cycle that array to push the data into a table? Or perhaps do it on the fly when looping through my parsing code?
Code:
Dim i As Integer
'Cycle through lines
For i = 0 To UBound(var) - 1
'Check if Move line
If (Len(var(i) > 0)) And (InStr(var(i), "[") = 0) Then
'Cycle through Move lines only
'Clear move line
tmpMove = ""
'Reset counter
x = 0
Do While (Len(var(i + x) > 0)) And (InStr(var(i + x), "[") = 0) And (UBound(var) > x + i - 1)
'Add the current row marked by i+x
tmpMove = tmpMove & var(i + x)
x = x + 1
If (UBound(var) < x + i) Then Exit Do
Loop
'Debug.Print i, x
i = i + x
'MsgBox tmpMove
Debug.Print tmpMove
'strPGNtoCSV = strPGNtoCSV & tmpMove & "," & Chr(10)
strPGNtoCSV = strPGNtoCSV & tmpMove & ";" & Chr(10)
Else
Debug.Print var(i)
'strPGNtoCSV = strPGNtoCSV & var(i) & "," & Chr(10)
strPGNtoCSV = strPGNtoCSV & var(i) & ";" & Chr(10)
End If
Next