pasin2
New member
- Local time
- Today, 11:57
- Joined
- May 27, 2021
- Messages
- 4
Hi,
I am writing a small program in vba for ms access. I need to write the following comparison but don't understand why it returns wrong result.
I am writing following line of code. All variables are currency type. The result should be 0 because the subtraction should give 0 as a result
result:
14360--14055.89---304.11
5.6843418860808E-13
3
I am writing a small program in vba for ms access. I need to write the following comparison but don't understand why it returns wrong result.
I am writing following line of code. All variables are currency type. The result should be 0 because the subtraction should give 0 as a result
Code:
day_diff=3
Debug.Print principal_tobepayed & "--" & amount & "---" & principal_payed
days(i) = IIf(day_diff > 0 And (principal_tobepayed - amount - principal_payed) <> 0, day_diff, 0)
Debug.Print principal_tobepayed - amount - principal_payed
Debug.Print days(i)
result:
14360--14055.89---304.11
5.6843418860808E-13
3