Code:
Public Sub subWriteOutput ( sDocType, sFileNameOut, sAcctType, sAcct, sDocTypeId, sDocDate, sScanOper, sDescPrompt, sConvToPDF)
'*********** Calculate length of sFileName and remove extension and change to .TIF for PDF conversion - above add in sOutRec below
iInactive = 0
iReceived = 1
sScanDate = Date
If sDocType = "CIF" Then
sOutRec = strImgOutput_file_path & sFileNameOut & vbTab & sDocTypeId & vbTab & sCif & vbTab & sDocDate & _
vbTab & iReceived & vbTab & iInactive & vbTab & sScanDate & vbTab & sScanOper & vbTab & sDescPrompt & _
vbTab & sCif & "-" & sDocTypeId & vbCrLf
'msgbox sOutRec
If sConvToPDF = "Y" Then
If sOneRowOnly = "Y" Then
If sOpen_CIF_OneRow = "N" Then
strOutput_Cif_OneRow = strTxtOutput_file_path & strLoanDepSwitch & "-Cif-OneRow.txt"
If objFSO.FileExists(strOutput_Cif_OneRow) Then
msg_num = Err.Number
msg_desc = "Output file already exists = " & strOutput_Cif_OneRow
Call LogEvent (strEventLog,strSourceName,msg_num,msg_desc,1,"local")
subExitProgram
Else
Set objOutputFile_CIF_OneRow = objFSO.OpenTextFile(strOutput_Cif_OneRow,ForWriting,True)
End If
sOpen_CIF_OneRow = "Y"
End If
objOutputFile_CIF_OneRow.Write sOutrec
Else
If sOpen_CIF_NewRow = "N" Then
strOutput_Cif_NewRow = strTxtOutput_file_path & strLoanDepSwitch & "-Cif-NewRow.txt"
If objFSO.FileExists(strOutput_Cif_NewRow) Then
msg_num = Err.Number
msg_desc = "Output file already exists = " & strOutput_Cif_NewRow
Call LogEvent (strEventLog,strSourceName,msg_num,msg_desc,1,"local")
subExitProgram
Else
Set objOutputFile_CIF_NewRow = objFSO.OpenTextFile(strOutput_Cif_NewRow,ForWriting,True)
End If
sOpen_CIF_NewRow = "Y"
End If
objOutputFile_CIF_NewRow.Write sOutrec
End If
Else
If sOneRowOnly = "Y" Then
If sOpen_CIF_OneRowPDF = "N" Then
strOutput_Cif_OneRowPDF = strTxtOutput_file_path & strLoanDepSwitch & "-Cif-OneRowPDF.txt"
If objFSO.FileExists(strOutput_Cif_OneRowPDF) Then
msg_num = Err.Number
msg_desc = "Output file already exists = " & strOutput_Cif_OneRowPDF
Call LogEvent (strEventLog,strSourceName,msg_num,msg_desc,1,"local")
subExitProgram
Else
Set objOutputFile_CIF_OneRowPDF = objFSO.OpenTextFile(strOutput_Cif_OneRowPDF,ForWriting,True)
End If
sOpen_CIF_OneRowPDF = "Y"
End If
objOutputFile_CIF_OneRowPDF.Write sOutrec
Else
If sOpen_CIF_NewRowPDF = "N" Then
strOutput_Cif_NewRowPDF = strTxtOutput_file_path & strLoanDepSwitch & "-Cif-NewRowPDF.txt"
If objFSO.FileExists(strOutput_Cif_NewRowPDF) Then
msg_num = Err.Number
msg_desc = "Output file already exists = " & strOutput_Cif_NewRowPDF
Call LogEvent (strEventLog,strSourceName,msg_num,msg_desc,1,"local")
subExitProgram
Else
Set objOutputFile_CIF_NewRowPDF = objFSO.OpenTextFile(strOutput_Cif_NewRowPDF,ForWriting,True)
End If
sOpen_CIF_NewRowPDF = "Y"
End If
objOutputFile_CIF_NewRowPDF.Write sOutrec
End If
End If
End If
If sDocType = "ACCT" Then
sOutRec = strImgOutput_file_path & sFileNameOut & vbTab & sDocTypeId & vbTab & sAcctType & sAcct & vbTab & sDocDate & _
vbTab & iReceived & vbTab & iInactive & vbTab & sScanDate & vbTab & sScanOper & vbTab & sDescPrompt & _
vbTab & sAcctType & sAcct & "-" & sDocTypeId & vbCrLf
If sConvToPDF = "Y" Then
If sOneRowOnly = "Y" Then
If sOpen_Acct_OneRow = "N" Then
strOutput_Acct_OneRow = strTxtOutput_file_path & strLoanDepSwitch & "-OneRow.txt"
If objFSO.FileExists(strOutput_Deposit_OneRow) Then
msg_num = Err.Number
msg_desc = "Output file already exists = " & strOutput_Acct_OneRow
Call LogEvent (strEventLog,strSourceName,msg_num,msg_desc,1,"local")
subExitProgram
Else
Set objOutputFile_Acct_OneRow = objFSO.OpenTextFile(strOutput_Acct_OneRow,ForWriting,True)
End If
sOpen_Acct_OneRow = "Y"
End If
objOutputFile_Acct_OneRow.Write sOutrec
Else
If sOpen_Acct_NewRow = "N" Then
strOutput_Acct_NewRow = strTxtOutput_file_path & strLoanDepSwitch & "-NewRow.txt"
If objFSO.FileExists(strOutput_Acct_NewRow) Then
msg_num = Err.Number
msg_desc = "Output file already exists = " & strOutput_Acct_NewRow
Call LogEvent (strEventLog,strSourceName,msg_num,msg_desc,1,"local")
subExitProgram
Else
Set objOutputFile_Acct_NewRow = objFSO.OpenTextFile(strOutput_Acct_NewRow,ForWriting,True)
End If
sOpen_Acct_NewRow = "Y"
End If
objOutputFile_Acct_NewRow.Write sOutrec
End If
Else
If sOneRowOnly = "Y" Then
If sOpen_Acct_OneRowPDF = "N" Then
strOutput_Acct_OneRowPDF = strTxtOutput_file_path & strLoanDepSwitch & "-OneRowPDF.txt"
If objFSO.FileExists(strOutput_Deposit_OneRowPDF) Then
msg_num = Err.Number
msg_desc = "Output file already exists = " & strOutput_Acct_OneRowPDF
Call LogEvent (strEventLog,strSourceName,msg_num,msg_desc,1,"local")
subExitProgram
Else
Set objOutputFile_Acct_OneRowPDF = objFSO.OpenTextFile(strOutput_Acct_OneRowPDF,ForWriting,True)
End If
sOpen_Acct_OneRowPDF = "Y"
End If
objOutputFile_Acct_OneRowPDF.Write sOutrec
Else
If sOpen_Acct_NewRowPDF = "N" Then
strOutput_Acct_NewRowPDF = strTxtOutput_file_path & strLoanDepSwitch & "-NewRowPDF.txt"
If objFSO.FileExists(strOutput_Acct_NewRowPDF) Then
msg_num = Err.Number
msg_desc = "Output file already exists = " & strOutput_Acct_NewRowPDF
Call LogEvent (strEventLog,strSourceName,msg_num,msg_desc,1,"local")
subExitProgram
Else
Set objOutputFile_Acct_NewRowPDF = objFSO.OpenTextFile(strOutput_Acct_NewRowPDF,ForWriting,True)
End If
sOpen_Acct_NewRowPDF = "Y"
End If
objOutputFile_Acct_NewRowPDF.Write sOutrec
End If
End If
End If
End Sub