Hi,
Could anybody explain me how to add the totals of a colomn in a database table?
Thanks in advance.
user777
Hi,
Could anybody explain me how to add the totals of a colomn in a database table?
Thanks in advance.
user777
with adodb:
dim conn as adodb.connection
dim rs as adodb.recordset
dim y as integer 'could also be long, double, currency
set conn = new adodb.connection
set rs = new adodb.recordset
conn.open "{ConnectionString}"
rs.open "select * from tblMain",conn,3,3,1
do while not rs.eof
y = y + rs.fields("total").value
' or y = y + rs.fields(3).value
rs.movenext
loop
rs.close
set rs = nothing
conn.close
set conn = nothing
debug.print Y
Try doing the total direct in your SQL
SELECT sum(column_name) as sum_column_name from table_name
Then use normal ADO/DAO or whatever to access the field sum_column_name
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.