Well, I have to ask another question about why this particular if statement is working not exactly the way I would like. I had made some changes to it by adding the set rs = .... and for some reason a section of it is not working anylonger. I have spent quite a lot of time on it and cant figure it out.
What is wrong: the first statement below dim, If Not IsNull......I believe that this statement is now being skipped for some reason even though LetterOfCreditOverride definitely is not null or 0. Before adding the rs stuff the code worked fine and this first line was not skipped.
What happens is that it skips that first line all the time. It did not do this before and I think it is some kind of easy fix that I am overlooking. Maybe some kind of conflict with rs but i doubt it. The placement of the rs code is of me and may be incorrect.
What should happen: When LetterOfCreditOverride is not null or 0 then locpercentage should equal Forms!frmDeals!LetterOfCre
ditOverrid
e. Again it worked just fine before implementing the rs code. I have been using the previous code for 2 years. I will post the previous code.
Public Function findletterofcreditfee(Lett
erOfCredit
NO As Boolean, ContractPrice As Currency, DealDate As Date) As Currency
Dim locpercentage As Single
If Not IsNull(Forms!frmDeals!Lett
erOfCredit
Override) And Not Forms!frmDeals!LetterOfCre
ditOverrid
e = 0 Then
locpercentage = Forms!frmDeals!LetterOfCre
ditOverrid
e
Else
'for LC Rate
Set rs = CurrentDb.OpenRecordset("S
ELECT t1.LCRate " & _
"FROM tblRateHistoryLC AS t1 " & _
"WHERE t1.fldStartDate = (SELECT Max(t2.fldStartDate) " & _
"FROM tblRateHistoryLC AS t2 " & _
"WHERE t2.fldStartDate <= #" & DealDate & "#)")
locpercentage = rs!LCRate
End If
If LetterOfCreditNO = True Then
findletterofcreditfee = 0
Else
If Forms!frmDeals!InsuranceOr
Guarantee = "Bridge" Then
'for LC Rate
Set rs = CurrentDb.OpenRecordset("S
ELECT t1.LCRate " & _
"FROM tblRateHistoryLC AS t1 " & _
"WHERE t1.fldStartDate = (SELECT Max(t2.fldStartDate) " & _
"FROM tblRateHistoryLC AS t2 " & _
"WHERE t2.fldStartDate <= #" & DealDate & "#)")
findletterofcreditfee = Forms!frmDeals!EligibleAmo
unt * rs!LCRate
Else
Set rs = CurrentDb.OpenRecordset("S
ELECT t1.LCRate " & _
"FROM tblRateHistoryLC AS t1 " & _
"WHERE t1.fldStartDate = (SELECT Max(t2.fldStartDate) " & _
"FROM tblRateHistoryLC AS t2 " & _
"WHERE t2.fldStartDate <= #" & DealDate & "#)")
findletterofcreditfee = Forms!frmDeals!FinancedAmo
unt * rs!LCRate
End If
End If
End Function