rs.open "select sum(字段) as nums from 表 where 条件"msgbox "字段总和" & rs("nums")

解决方案 »

  1.   

    不懂, 是要求MSFLEXGRID表格里的字段和吗,如果是的话,做个循环就行了.
      

  2.   

    iCurCol=grid.colsel
    grid.col=icurcol
    for i=1 to allrows
        sum=sum+cint(grid.row)
    next
      

  3.   

    MSFLEXGRID是否与记录集绑定?
    如果绑定,用小高的方法,否则用深蓝的做法。
    dim i as long, dTotal as doubledTotal = 0
    with MSFlexGrid1
    .col = 2    '假定汇总第二列
    for i = 1 to .rows-1    '避开表头(row = 0)
    .row = i
    dtotal = dtotal + val(.text)
    next i
    end withmsgbox "总计:" & dtotal