请问如何对查询出来的结果做统计(求记录数)?谢谢~~!

解决方案 »

  1.   

    Set Rs=Cnn.execute("select count(*) from Row from 表名")
    With Rs
      Msgbox !Row
    End with
      

  2.   

    Private Sub Command6_Click()
    Adodc5.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\中安科.mdb;Persist Security Info=False"
    Adodc5.RecordSource = "select count(*) as 记录数 from 基本情况表4 where " & Trim(Combo2.Text) & " like '*" & Text10.Text & "*'"
    Adodc5.Refresh
    End Sub我是这么做的,
    不过老有问题
      

  3.   

    是想在Combo2  中选择一个字段名
    然后再在Text10.Text 中输入一个值
    (既对某字段下值为Text10.Text的记录进行记数)
      

  4.   

    Private Sub Command6_Click()
    If Adodc5.Recordset.RecordCount > 0 Then '若记录非空
        Adodc5.Recordset.Find " " & Trim(Combo2.Text) & " like '*" & Text10.Text & "*' "
        
          Label27.Caption = "共查询到符合条件的记录 " & Adodc5.Recordset.RecordCount & " 条!"
       If Adodc5.Recordset.EOF = True Then
         MsgBox "对不起,没找到您要查找的关键字,请确认输入无误后再继续查找!", vbExclamation, "提示"
         Label27.Caption = "共查询到符合条件的记录 0条!"
         Adodc5.Refresh
       End If
      End If
    End Sub
    不过这样得到的是所有记录的总数,而不只是符合条件的记录数