各位大虾,我如何对过滤后所显示的一列的值进行汇总(在不生成新表的情况下)

解决方案 »

  1.   

    Option Explicit'程序中用了 DataGrid 和 Adodc ,数据库用的是 NWIND.MDBPrivate Sub Command1_Click()
    Dim i As Integer
    Dim DBLSume As Double
    DataGrid1.Row = 2
    DataGrid1.Col = 2
    i = 1
    Do Until Adodc1.Recordset.EOF '‘ = True '.MoveLast
    DataGrid1.Row = i
    DataGrid1.Col = 7      '要汇总的值所在的第8列
    On Error GoTo myerror
    DBLSume = DBLSume + CDbl(DataGrid1.Text)
    i = i + 1
    Loop
    myerror:
      MsgBox DBLSume
      Adodc1.Refresh
    End Sub
      

  2.   

    谢谢楼上二位,我在运行该程序时报错
    “行设置不可用”DataGrid1.Row = 2,望大虾继续开导