Greetings, all.
Thank you in advance for responding to my question.
I have a SQLite DB - 2 tables, Account and Transactions. The Account record contains a balance due field. The Transaction record includes charges and payments. All amounts have 2 decimals ($$$,$$$.cc).
I am writing a simple trial balance. Take the amounts from the transactions, add them and then compare to the Balance Due in the Account record. This must sound familiar to most since I have done this or similar processing in other programming languages.
All amounts in the SQLite DB are type REAL. In retrieving the amounts for both the transactions and the Account, I use a Type Double. I believe I get false errors due to the conversion from real to double.
What are best practices to deal with this type of processing?
Any and all help is welcomed.
Dim account_amt As Double
Dim tran_total As Double
Dim tran_amt As Double
account_amt=Cursor1.Getdouble("Current Balance")
***
query = "Select * FROM Tran WHERE [Account ID] = " & acct_id
Cursor2 = SQL.ExecQuery(query)
Select Cursor2.RowCount
Case 0
tran_total=0
Case Else
For j = 0 To Cursor2.RowCount - 1
Cursor2.Position=j
tran_amt=Cursor2.Getdouble("Amount")
tran_total=tran_total+tran_amt
Next
If account_amt<>tran_total Then
Log (acct_id & "*" & account_amt & "*" & tran_total)
End If
End Select