Importing and Parsing Records

mlr0911

Registered User.
Local time
Yesterday, 22:46
Joined
Oct 27, 2006
Messages
155
Hello All,

I was hoping that someone could help me with a problem I am having. I am trying to parse and import 4 pieces of information from a text document. I can import 2 pieces of data, but when I try to bring in all 4, it bombs.

Thanx in advance for your help.

Here is a sample code:

' parse record by delimiter, populating each field...
If (Len(strRecord) > 0) Then
lngreccount = lngreccount + 1

' update status display every 10 records...
If lngreccount Mod 10 = 0 Then
Call SysCmd(acSysCmdSetStatus, "Calculating Import " & Trim(Str(lngreccount)) & "...")
End If

' hand off to o/s every 100 records...
If lngreccount Mod 100 = 0 Then
DoEvents
End If

' process the record...
If (UCase(Mid(strRecord, 2, 18)) = "PJL COMMENT COPIES") Then

strHeader = Mid(strRecord, 26, 2)
End If


If (UCase(Mid(strRecord, 2, 15)) = "XXXXXXXXXXXXAC") Then

stracctnum = Mid(strRecord, 25, 11)




If (UCase(Mid(strRecord, 2, 21)) = "XXXXXXXXXXXXXXXXXCODE") Then

strStType = Mid(strRecord, 26, 6)


If (UCase(Mid(strRecord, 2, 22)) = "XXXXXXXXXXXXXXXXXXXXDT") Then

strDate = Mid(strRecord, 25, 11)






lngrecwritten = lngrecwritten + 1

objrs.AddNew
objrs("Count") = strHeader
objrs("Num") = strnum
objrs("Type") = strType
objrs("Date") = strDate

objrs.Update

End If
End If
Loop

Call SysCmd(acSysCmdClearStatus)
Beep
MsgBox "Statement Calculation Successful: " & Chr(13) & Chr(13) & Trim(Str(lngreccount)) & " lines read (including headers)" & Chr(13) & DSum("count", "tblimport", "count") & " statements found."

GoTo ImportExit
 
Nevermind, I found out what my problem was. I needed to set the code in order of the way the document read.

Thanx
 

Users who are viewing this thread

Back
Top Bottom