Sub colcount()
Dim intcount As Integer
If Adodc1.Recordset.RecordCount <> 0 Then
    For i = 0 To Adodc1.Recordset.RecordCount - 1
    intcount = intcount + Val(rs.Fields("某列"))
    Adodc1.Recordset.MoveNext
    Next
End If
label1.Caption = Count
'你可以把 colcount 放到操作(删除,增加)之后!
End Sub

解决方案 »

  1.   

    补充,上面一句话错误!
    +++++++++++++
    intcount = intcount + Val(Adodc1.Recordset.Fields("某列"))
      

  2.   

    利用SQL语句就行了
       select sum(File) from TABLE
    这样你就可以用得到了这个字段的和
      

  3.   

    gan973236(飞虎 我也想用这句话, 但是用到什么地方呢? 
     no_com(探花) 的方法也不错
      

  4.   

    by the way  问一下, no_com(探花) 的句子可以放在 Adodc1_RecordChangeComplete 中间会不会好些?
      

  5.   

    Private Sub Command4_Click()
    MonthView1.Visible = False
    Combo1.Enabled = False
    Combo2.Enabled = False
    Option1.Value = False
    Option2.Value = False
    yearmonth = 1        Label3.Caption = CStr(qyear) & "年" & CStr(qmonth) & "月统计数据:"
            datPrimaryRS.Close
            ssql2 = "select sum(委托金额) as sum1,sum(领料总额) as sum2,sum(毛利润) as sum3,sum(实际欠款) as sum4, sum(外协总额) as sum5, sum(已清款项) as sum6, sum(未开票款) as sum7 from 订单 where year(订单日期) =" & qyear & "and month(订单日期) =" & qmonth & " "
            datPrimaryRS.Open ssql2, dfwConn, adOpenForwardOnly, adLockReadOnly
            Call mytext
            
    sSQL = "select 随印卡号,委托单位,业务员,订单日期,品名,委托金额,实际欠款,已清款项,未开票款,领料总额,外协总额,毛利润,完成日期,预付款,数量,二次付款,二次付款日期,三次付款,三次付款日期,四次付款,四次付款日期,订单备注,领料1,数量1,领料金额1,领料2,数量2,领料金额2,领料3,数量3,领料金额3,领料4,数量4,领料金额4,领料5,数量5,领料金额5 from 订单 where year(订单日期) =" & qyear & " and month(订单日期) =" & qmonth & " Order by 随印卡号"
    Set datPrimaryRS = New Recordset
    datPrimaryRS.CursorLocation = adUseClient
    datPrimaryRS.Open sSQL, dfwConn, adOpenForwardOnly, adLockReadOnly
    Set MSHFlexGrid1.DataSource = datPrimaryRS
    End Sub
    Sub mytext()
           If datPrimaryRS!sum1.Value <> "" Then
           Text1.Text = Format(datPrimaryRS!sum1.Value, "#0.0")
              Else
              Text1.Text = "0"
            End If
           If datPrimaryRS!sum2.Value <> "" Then
           Text2.Text = Format(datPrimaryRS!sum2.Value, "#0.0")
              Else
              Text2.Text = "0"
            End If
           If datPrimaryRS!sum3.Value <> "" Then
           Text3.Text = Format(datPrimaryRS!sum3.Value, "#0.0")
              Else
              Text3.Text = "0"
            End If
           If datPrimaryRS!sum4.Value <> "" Then
           Text4.Text = Format(datPrimaryRS!sum4.Value, "#0.0")
              Else
              Text4.Text = "0"
            End If
     
    End Sub