I HAVE THREE TABLES TBLEXPAFTERutil, TBLEXPECTEDLOSS, and tblfacility
recoveryrate. the values on the fields of those tables changes after certain
time(frequently, 6-12 months). so how my system is now is that the field is changed
on table and older field is overwritten with new field. so when the report is run,
it displays the values with current records from that field.
so after the fields are changed(overwritten) if i run the reports from previous year it still takes the values from current time, which outputs the reports with wrong results.
so i want to implement the way after the values in the fields are changed, the new report would take the values from new field while old report would take values from time.
here are the field in that tables which changes after certain period.
tblExpAfterutil- "RiskGrade"," DrawRatio"
tblExpectedLoss-"RiskGrade","DrawRatio","JapanesePd","NonJapanesePd"
tblFacilityrecoveryrates- 'facilityRating','RecoveryRates'
* DrawRation and RiskGrade in both tables will hold same records.
so how sould i do that, should i create a new table after everychages and change in
store procedure and and function if the given date is certain, then use values from this table, if not from other table.then looks like after every 6-12 months or so i
have to create new tables. or should i add one more field in table like have datefield, and after changes are added( withoutover writing previous rates and ratio....) put certain date and when reports of previous years are run take the values from that field for calculation. But still i donot know how to implement this.
i have attached the all storeprocedure,function,and tables, and code for form from where report is opened.
help me out here. Guys
Appreciate it
Derek
here is one of the function that is used called in my store procedure. Please tell me how to modify the function so that when exam date( report for that year) can be passed as parameter and according to that year, it would select the rating index, rates and other values, for calculation of that year. i am thinking about adding date field in all those table(year) for different ratings and ration.
and here is the code from where the report is called to be dispalyed.
recoveryrate. the values on the fields of those tables changes after certain
time(frequently, 6-12 months). so how my system is now is that the field is changed
on table and older field is overwritten with new field. so when the report is run,
it displays the values with current records from that field.
so after the fields are changed(overwritten) if i run the reports from previous year it still takes the values from current time, which outputs the reports with wrong results.
so i want to implement the way after the values in the fields are changed, the new report would take the values from new field while old report would take values from time.
here are the field in that tables which changes after certain period.
tblExpAfterutil- "RiskGrade"," DrawRatio"
tblExpectedLoss-"RiskGrade","DrawRatio","JapanesePd","NonJapanesePd"
tblFacilityrecoveryrates- 'facilityRating','RecoveryRates'
* DrawRation and RiskGrade in both tables will hold same records.
so how sould i do that, should i create a new table after everychages and change in
store procedure and and function if the given date is certain, then use values from this table, if not from other table.then looks like after every 6-12 months or so i
have to create new tables. or should i add one more field in table like have datefield, and after changes are added( withoutover writing previous rates and ratio....) put certain date and when reports of previous years are run take the values from that field for calculation. But still i donot know how to implement this.
i have attached the all storeprocedure,function,and tables, and code for form from where report is opened.
help me out here. Guys
Appreciate it
Derek
here is one of the function that is used called in my store procedure. Please tell me how to modify the function so that when exam date( report for that year) can be passed as parameter and according to that year, it would select the rating index, rates and other values, for calculation of that year. i am thinking about adding date field in all those table(year) for different ratings and ration.
Code:
ALTER Function Fn_CalcExpAfterUtil
(@Mat smalldatetime , @InitialDate smalldatetime, @AuthorizeDate smalldatetime,
@TradeID varchar(50), @RiskGrade varchar(50), @ExpComm bigint, @ExpTF bigint, @Exp bigint)
Returns float
as
Begin
Declare @RetVal float
Declare @RatingIndex Bigint
Declare @Draw AS Float
If (@ExpComm = 0 And @ExpTF = 0)
Begin
Set @RetVal=@Exp
Goto ExitRoutine
End
If (@ExpTF > 0)
Begin
If (@TradeID <> 'LCI' And @TradeID <> 'LCL' And @TradeID <> 'LCPRC' And @TradeID <> 'LCU')
Begin
Set @RetVal=@Exp
Goto ExitRoutine
End
End
If @RiskGrade = '99' Or @RiskGrade = '00' Or Len(Isnull(@RiskGrade,0)) = 1
Begin
If (Len(Isnull(@InitialDate,0)) <> 0 And Len(Isnull(@AuthorizeDate,0)) <> 0)
Begin
If (@AuthorizeDate < '7/10/01')
Begin
Set @RiskGrade = '06'
End
Else If (@InitialDate < '7/10/01')
Begin
Set @RiskGrade = '06'
End
Else
Begin
Set @RiskGrade = '061'
End
End
Else
Begin
Set @RiskGrade = '06'
End
End
Set @RatingIndex = 1
If (Len(Isnull(@InitialDate,0)) <> 0 And Len(Isnull(@AuthorizeDate,0)) <> 0)
Begin
If (@AuthorizeDate < '7/10/01')
Begin
Set @RatingIndex = 1
End
Else If (@InitialDate < '7/10/01')
Begin
Set @RatingIndex = 1
End
Else
Begin
Set @RatingIndex = 2
End
End
If (@RatingIndex = 2)
Begin
If (@RiskGrade = '05' Or @RiskGrade = '06')
Begin
Set @RiskGrade = @RiskGrade + '1'
End
End
If (@RiskGrade = '051' Or @RiskGrade = '052' Or @RiskGrade = '061' Or @RiskGrade = '062' Or @RiskGrade = '083')
Begin
Set @RatingIndex = 2
End
If (@RatingIndex = 1)
Begin
Select @Draw=(DrawRatio/100) from tblAQRExpAfterUtil where RatingIndex=1 and RiskGrade=left(@RiskGrade, 2)
End
Else
Begin
Select @Draw=(DrawRatio/100) from tblAQRExpAfterUtil where RISKGRADE =@RISKGRADE AND RATINGINDEX <> 1
End
Set @RetVal= @Exp * @Draw
Goto ExitRoutine
ExitRoutine:
Return @RetVal
End
and here is the code from where the report is called to be dispalyed.
Code:
Private Sub cmbDateList_Enter()
Dim strSql As String
strSql = "SELECT DISTINCT([yymmdd]) FROM tblmaster where OrgUnit = '" & Me.cmbExamList & "' "
Me.cmbDateList.RowSource = strSql
End Sub
Private Sub cmbExamList_Enter()
Me.cmbDateList = ""
End Sub
Private Sub cmbRegionList_Enter()
Me.cmbRegionList.Requery
End Sub
Private Sub cmdShowReport_Click()
Dim bflag As Boolean
On Error GoTo Error_cmdShowReport_Click
bflag = bValidate("EXAM")
If bflag = False Then
GoTo Exit_cmdShowReport_Click
End If
bflag = bExecuteQuery("EXAM", "")
If bflag = False Then
GoTo Exit_cmdShowReport_Click
End If
If Me.cmbGradeList = "Original Grade" Then
DoCmd.OpenReport "rptAssetRating_OrgGrade", acPreview
ElseIf Me.cmbGradeList = "CEA Grade" Then
DoCmd.OpenReport "rptAssetRating_CEAGrade", acPreview
End If
Me.Visible = False
Exit_cmdShowReport_Click:
Exit Sub
Error_cmdShowReport_Click:
MsgBox Err.Number & " " & Err.Description, vbCritical, "CIMS"
Resume Exit_cmdShowReport_Click
End Sub