Hi:This is the original function which is called from an external script file. The program basically read data from database and create a text file. In that file i need to add two more rows of Bankcrupcy case number and bank crupcy chapter number. So I copy the same function and create two more function by changing the variable and table field names. I check the two new functions and they shows the values in the debug mode which i need. The program reads the script file. Below are the two lines of the script file. I put a message box in the case and run the program. When program runs it shows the message box and after the message box the program enters into the function GetDeceasedDate


SCRIPT FILE
-----------
Case "400", "402", "403", "404", "406", "407"
msgbox "400 402 403 404 406 407"
.Field("MaintRecord.NewValue") = "03A" & .GetBankruptcyDate(.Field("MaintRecord.AcctNum"))

so i try it by myself first and copy the above code with the other two function names like that:

Case "400", "402", "403", "404", "406", "407"
msgbox "400 402 403 404 406 407"
.Field("MaintRecord.NewValue") = "03A" & .GetBankruptcyDate(.Field("MaintRecord.AcctNum"))
msgbox "This is GetBankruptcyCaseNumber"
.Field("MaintRecord.NewValue") = "03A" & .GetBankruptcyCaseNumber(.Field("MaintRecord.AcctN um"))
msgbox "This is GetBankruptcyChapter"
.Field("MaintRecord.NewValue") = "03A" & .GetBankruptcyChapter(.Field("MaintRecord.AcctNum" ))

Now after the above changes in the script file when i run the program again it shows the first message box and then enter into the function GetDeceasedDate and create one record into a text file and then again shows the message box: "This is GetBankruptcyCaseNumber" and when i press enter it is not going into function GetBankruptcyCaseNumber but again shows the message box with value "This is GetBankruptcyChapter" and then do other processes and then program was end. Another problem is the records which pull in all three functions have sam status code which is 404 so i think i cant also write a new case in the script file.

ANY IDEA OR HELP OR SUGGESTION WHAT I DO CHANGES IN THE SCRIPT FILE SO THAT THE OTHER TWO FUNCTIONS WILL ALSO EXECUTE WOULD
BE HIGHLY APPRECIATE

Thanks.

ORIGINAL FUNCTION IN THE PROGRAM
--------------------------------
Public Function GetDeceasedDate(ByVal AcctNum As Variant) As String
Dim RS As New ADODB.Recordset
Dim DBConn As ADODB.Connection
Dim SQL As String, strDate As String

AcctNum = Trim(AcctNum)

SQL = "set temporary option user_estimates = 'enabled'; " & _
" Select date1 from dbtrudf du " & _
" left outer join debt as d on (d.debt_id = du.debtor_id,0) " & _
" where label = 'DeceasedDate' " & _
" and clt_ref_no = '" & Trim(AcctNum) & "'"

Set DBConn = CommonFunctions.GetDBConn
Set RS = DBConn.Execute(SQL)

If Not RS.EOF And Not IsNull(RS!DATE1) Then
strDate = Format$(CStr(RS!DATE1), "yyyymmdd")
Else
MsgBox AcctNum & " is an 03B with no deceased date!"
End If
GetDeceasedDate = strDate
End Function


THE TWO FUNCTIONS WHICH I ADD IN THE PROGRAM
--------------------------------------------
Public Function GetBankruptcyCaseNumber(ByVal AcctNum As Variant) As String
Dim RS As New ADODB.Recordset
Dim DBConn As ADODB.Connection
Dim SQL As String, strCaseNumber As String

AcctNum = Trim(AcctNum)

SQL = "set temporary option user_estimates = 'enabled'; " & _
" Select LongStr from dbtrudf du " & _
" left outer join debt as d on (d.debt_id = du.debtor_id,0) " & _
" where label = 'CaseNumber' " & _
" and clt_ref_no = '" & Trim(AcctNum) & "'"
Debug.Print SQL
Set DBConn = CommonFunctions.GetDBConn
Set RS = DBConn.Execute(SQL)

If Not RS.EOF And Not IsNull(RS!LongStr) Then
strCaseNumber=RS!LongStr
Else
MsgBox AcctNum & " is an 03A with no Bankruptcy Value!"
End If
GetBankruptcyCaseNumber = strCaseNumber
End Function

Public Function GetBankruptcyChapter(ByVal AcctNum As Variant) As String
Dim RS As New ADODB.Recordset
Dim DBConn As ADODB.Connection
Dim SQL As String, StrBankruptcyChapter As String

AcctNum = Trim(AcctNum)

SQL = "set temporary option user_estimates = 'enabled'; " & _
" Select LongStr from dbtrudf du " & _
" left outer join debt as d on (d.debt_id = du.debtor_id,0) " & _
" where label = 'BankruptcyChapter' " & _
" and clt_ref_no = '" & Trim(AcctNum) & "'"
Debug.Print SQL
Set DBConn = CommonFunctions.GetDBConn
Set RS = DBConn.Execute(SQL)

If Not RS.EOF And Not IsNull(RS!LongStr) Then
StrBankruptcyChapter=RS!LongStr
Else
MsgBox AcctNum & " is an 03A with no Bankruptcy Chapter!"
End If
GetBankruptcyChapter = StrBankruptcyChapter
End Function


SOME MORE PARTS OF THE SCRIPT FILE
----------------------------------
Select Case SourceImpExp.TrimField("STATUS_CODE")
Case "491"
.Field("MaintRecord.NewValue") = "03D"
'.Field("Recall.RECALL_REASON")= "CEASE/DESIST"
'corkr01 1/26/07
Case "400", "402", "403", "404", "406", "407"
.Field("MaintRecord.NewValue") = "03A" & .GetBankruptcyDate(.Field("MaintRecord.AcctNum"))
Case "450"
.Field("MaintRecord.NewValue") = "03B" & .GetDeceasedDate(.Field("MaintRecord.AcctNum"))
Case "485"
.Field("MaintRecord.NewValue") = "03C"
'.Field("Recall.RECALL_REASON")= "FRAUDULENT"
Case "710"
.Field("MaintRecord.NewValue") = "03E"
'.Field("Recall.RECALL_REASON")= "DISPUTED ACCOUNT"
Case "409"
.Field("MaintRecord.NewValue") = "03S"
'.Field("Recall.RECALL_REASON")= "Consumer Credit Counseling aka DMP Return"
Case Else
CommonFunctions.ScriptVariable("TotalTrans").Opera tor("-") = 1
MapToClientExportFileType = ""
End Select