i need to add a different data from another place in the file but in the same record in the next column and not as new record. tired one and gives me an error like
The record from A02 is added and updated. haven't closed the record as i need to add more data in the same recod. Then tried the same in A07. The A07 lies below the A02 code, below is the code
Code:
object invalid or not set
Code:
If Left(TextLine, 3) = Trim("A02") Then 'First A02(PAX) line
Pax = Trim(Mid(TextLine, 4, 30))
tkt = ALC & Trim(Mid(TextLine, 49, 10))
PaxType = Trim(Mid(TextLine, 67, 6))
RS.AddNew
RS![FileName] = srcfile
RS![Passengers] = Pax
RS![PNR] = PNR
RS![tkt#] = tkt
RS![PaxType] = PaxType
RS.Update
txtMIRActivity.Value = srcfile & " " & tkt & " " & "Processed" & vbNewLine & txtMIRActivity.Value
tktDisp = ALC & Trim(Mid(TextLine, 49, 10))
If Trim(Mid(TextLine, 49, 10)) = "" Then
Close #1
'Name SrcFolder & srcfile As NoTicket & srcfile
txtMIRActivity.Value = srcfile & " " & PNR & " " & "No Ticket number " & vbNewLine & txtMIRActivity.Value
GoTo NextFile 'Abort and move to next file
Else
tktNum = Trim(Mid(TextLine, 49, 10))
End If
passenger = tkt & " " & Pax
Line Input #1, TextLine
Line Input #1, TextLine
Do While Left(TextLine, 3) = ("A02") 'Loops through following A02 (Pax) lines (if any)
Pax = Trim(Mid(TextLine, 4, 30))
tkt = ALC & Trim(Mid(TextLine, 49, 10))
PaxType = Trim(Mid(TextLine, 67, 6))
txtMIRActivity.Value = srcfile & " " & tkt & " " & "Processed" & vbNewLine & txtMIRActivity.Value
RS.AddNew
RS![FileName] = srcfile
RS![Passengers] = Pax
RS![PNR] = PNR
RS![tkt#] = tkt
RS![PaxType] = PaxType
RS.Update
'RS.Close
Line Input #1, TextLine
Line Input #1, TextLine
Loop
End If
If Left(TextLine, 3) = "A07" Then 'Reads base fare, Total fare and 5 Tax's
BFC = Trim(Mid(TextLine, 6, 3)) & ": "
BaseFare = Mid(TextLine, 9, 12)
If Trim(Mid(TextLine, 39, 12)) = "" Then
EQAmt = 0
Else
EQAmt = CDbl(Mid(TextLine, 39, 12))
[COLOR=Red]RS![EquivalentAmount] = EQAmt[/COLOR]
RS.Update
End If
TotalFare = Mid(TextLine, 24, 12)
Tax = Trim(Mid(TextLine, 57, 8)) & "+" & _
Trim(Mid(TextLine, 70, 8)) & "+" & _
Trim(Mid(TextLine, 83, 8)) & "+" & _
Trim(Mid(TextLine, 96, 8)) & "+" & _
Trim(Mid(TextLine, 109, 8))
End If