I have an app that takes multiple text files, imports to a table, modifies data in the records, exports back to a text file. Problem is in the order of the records after a particlar process.
The process deletes certain records, puts them in a new table, modifies them and then puts them back into the original table. This usually works fine. Records are added to the end. It appears that it will randomly (various input files) put the new records at the beginning of the table. I have changed the order of files and still no pattern or reason for the wrong order.
CODE:
tir_in is the original file, BZC records are deleted, manipulated and added back to the (usually) end of tir_in.
cn.Execute "DELETE * FROM tir_in WHERE di=" & "'BZC'"
rsTIR_IN.Open strTIR, cn, , , adCmdTable
intBZC = DCount("*", "tbl_BZC")
If intBZC > 0 Then
rsBZC.MoveFirst
Do While Not rsBZC.EOF
'Append to TIR_IN
With rsTIR_IN
'.MoveLast tried movelast but did not solve problem
.AddNew
!di = "BZC"
!ri_to = rsBZC!ri_to
!RI_From = rsBZC!RI_From
!ric = rsBZC!ric
!doc_no = rsBZC!doc_no
!b5 = rsBZC!b5
!qty = rsBZC!qty
!prep_date = rsBZC!prep_date
.Update
End With
rsBZC.MoveNext
Loop
End If
The process deletes certain records, puts them in a new table, modifies them and then puts them back into the original table. This usually works fine. Records are added to the end. It appears that it will randomly (various input files) put the new records at the beginning of the table. I have changed the order of files and still no pattern or reason for the wrong order.
CODE:
tir_in is the original file, BZC records are deleted, manipulated and added back to the (usually) end of tir_in.
cn.Execute "DELETE * FROM tir_in WHERE di=" & "'BZC'"
rsTIR_IN.Open strTIR, cn, , , adCmdTable
intBZC = DCount("*", "tbl_BZC")
If intBZC > 0 Then
rsBZC.MoveFirst
Do While Not rsBZC.EOF
'Append to TIR_IN
With rsTIR_IN
'.MoveLast tried movelast but did not solve problem
.AddNew
!di = "BZC"
!ri_to = rsBZC!ri_to
!RI_From = rsBZC!RI_From
!ric = rsBZC!ric
!doc_no = rsBZC!doc_no
!b5 = rsBZC!b5
!qty = rsBZC!qty
!prep_date = rsBZC!prep_date
.Update
End With
rsBZC.MoveNext
Loop
End If