Open SrcFolder & srcfile For Input As #1 'Open specified file
Pax = Empty 'clear variable for next file
tkt = Empty 'clear variable for next file
Do While Not EOF(1)
Line Input #1, TextLine
If Left(TextLine, 2) = "T5" Then
.......................CODE follows.....................
If Left(TextLine, 3) = "A12" Then 'Reads Phone field
.......................CODE follows.....................
End If
Loop ' EOF
Close #1 ' Close file
If DCount("TicketNoID", "tblticketNumber", "[TicketNumber]=" & tkt) Then 'Find ticket # Duplicate
Name SrcFolder & srcfile As DupFolder & srcfile
txtMIRActivity.Value = txtMIRActivity.Value & _
srcfile & " " & tkt & " " & _
"DUPLICATE TICKET " & vbNewLine
GoTo NextFile ' quits further processing as ticket number already exists so moves to next file
End If
If Len(Pax) = 0 Then ' no passengers
Name SrcFolder & srcfile As ErrorFolder & srcfile
txtMIRActivity.Value = txtMIRActivity.Value & _
srcfile & " " & _
"No Passenger(s)" & vbNewLine
GoTo NextFile ' quits further processing as no passenger info is available in current file so moves to next file
Else
RSTkt.AddNew
RSTkt![FileName] = srcfile
RSTkt![TicketNumber] = tkt
tkt = Empty
RSTkt.Update 'update tblTicketNumber
End If
RS.AddNew
RS![FileName] = srcfile
RS![DateAndTime] = Now()
RS![IATACode] = IATACode
RS![I/OGTIDS] = IOGTID
RS![MIRCreationDate] = MIRDate
RS![IssuingAirline] = IssueAirline
RS![BTPcc] = BkgTkgPCC
RS![PNR] = PNR
RS![BS/SBI/TS/DutyCode] = BkgSignOnTkgSignOn
RS![PNRCreationDate] = PNRDate
RS![Passengers] = passenger
RS![sector] = AirSector
RS![Tax's] = Tax
RS![EquivalentAmount] = EQAmt
RS![BaseFare] = BaseFare
RS![TotalFare] = TotalFare
RS![FOP] = FOP
RS![ActuallyCollected] = ActualAMTCol
RS![PhoneField] = phoneFieldCont
RS.Update 'update the tblMIR
'Pax = Empty
'tkt = Empty
txtMIRActivity.Value = txtMIRActivity.Value & srcfile & " " & tktDisp & " " & "Processed" & vbNewLine
Name SrcFolder & srcfile As DstFolder & srcfile
NextFile:
srcfile = Dir 'get next file
Loop 'srcfile
RS.Close ' Close the table
txtMIRActivity.Value = txtMIRActivity.Value & "Completed" & " " & "[" & Now() & "]" & vbNewLine
Set RS = Nothing ' Clear RS
Set RSTkt = Nothing ' clear RSTkt
DoCmd.Hourglass False
Err:
If Error >= 0 Then
Else
MsgBox "Error #: " & Err.Number & vbCrLf & vbCrLf & Err.Description
End If
End Sub