After below code runs, the result is 310, however the result of VBA code should be 321.3, all the digits after the decimal points were ignored in calculation. why does this happens? Many thanks for help.
PHP:
Dim cnn As Object, SQL$, s$, p$, f$
Set cnn = CreateObject("ADODB.Connection")
p = ThisWorkbook.Path & "\"
f = Dir(p & "*.CSV")
cnn.Open "Provider=Microsoft.ace.OLEDB.16.0;Extended Properties='text;FMT=Delimited(,);hdr=YES';Data Source=" & p
Do While f <> ""
SQL = SQL & " SELECT INT(Date) AS T, Amount FROM [" & f & "] UNION ALL "
f = Dir()
Loop
SQL = Left(SQL, Len(SQL) - 11)
SQL = "SELECT T,SUM(Amount) FROM (" & SQL & ") GROUP BY T"
[A2:E1048576] = ""
[a2].CopyFromRecordset cnn.Execute(SQL)
cnn.Close
Set cnn = Nothing
Dim R%
R = [A1048576].End(3).Row
[a1].Offset(R, 0) = "Sum"
[b1].Offset(R, 0).Resize(1, 4) = "=sum(b2:b" & R & ")"