This Expression not giving expected result

PNGBill

Win10 Office Pro 2016
Local time
Tomorrow, 02:32
Joined
Jul 15, 2008
Messages
2,271
This expression is not giving the expected result.

InterestAmount: ((([LoanKinaAmount]*[TblInterestRate]![DailyCompound])/100)/365.25)*[DaysNumber]

A real example is (((8,280.64*10.515578)/100)365.25)*123

Access query result is 610.90 yet a calculator gives result of 293.23:confused:

I have changed the source data values and in each case the query gave an expected different result indicating it is looking at the correct data just calculating it wrong - but why?? and how to fix??
 
Here is my sql query

SELECT QryLoanDetails.LoanDetailID, QryLoanDetails.InterestMethod, [SimpleInterest]/100 AS InterestRate, IIf(DateDiff("d",[LoanStartDate],DLookUp("[YearEnd]","TblFinancialYear"))>365,365,DateDiff("d",[LoanStartDate],DLookUp("[YearEnd]","TblFinancialYear"))) AS DaysNumber, ((([LoanKinaAmount]*[TblInterestRate]![DailyCompound])/100)/365.25)*[DaysNumber] AS InterestAmount, [LenderFirstName] & " " & [LenderLastName] AS FullName, DLookUp("[YearEnd]","TblFinancialYear") AS YearEndDate, "Initial Principal Interest" AS InterestNotation, (Ignore this part(((8280.64*10.515578)/100)/365.25)*123 AS NewInterest) Just a test to see if query can calculate!!
FROM (TblInterestRate RIGHT JOIN QryLoanDetails ON TblInterestRate.InterestRateID = QryLoanDetails.InterestRateID) INNER JOIN TblLender ON QryLoanDetails.LenderID = TblLender.LenderID
WHERE (((QryLoanDetails.InterestMethod)="DailyCompound") AND ((QryLoanDetails.LoanStartDate) Between DLookUp("[YearStart]","TblFinancialYear") And DLookUp("[YearEnd]","TblFinancialYear")));
 
Panic over. If anyone has already called Bill Gates, please give him my apologise.:o

I was looking at the table whereas some of the data was coming from a query that first converted the currency, hence the value of [LoanKinaAmount] is not the same as the value on the field I was looking at in the table.

:(
 
I substituted each of the three variables in the expression, one at a time, with typed in data and only one of the three substitutions made a diff. I then targeted this field and released my error, not in the query but in my checking of the result.:o Oh ye of little faith!
 

Users who are viewing this thread

Back
Top Bottom