这样写有问题吗?谢谢~~!  
If Adodc4.Recordset.RecordCount > 0 Then '若记录非空
     Adodc4.Recordset.Find "select * from 年检表 where 年检时间 between #" & Format(DTPicker1.Value, "yyyy-mm-dd") & "# and #" & Format(DTPicker2.Value, "yyyy-mm-dd") & "#"""
   If Adodc4.Recordset.EOF = True Then
     MsgBox "对不起,没找到您要查找的关键字,请确认输入无误后再继续查找!", vbExclamation, "提示"
     Adodc4.Refresh
   End If
  End If

解决方案 »

  1.   

    要是 不要""会出现WITH 语句未定义
      

  2.   

    Find后面应该是逻辑表达式吧,不能用SQL语句吧?
      

  3.   

    Find后面可以查找一个字段的值,没这么用过。
      

  4.   

    Adodc4.Recordset.open"select * from 年检表 where 年检时间 between #" & CDate(DTPicker1.Value) & "# and #" & CDate(DTPicker2.Value) & "#""
    还是不行你就定义一个新的Recordset
    如Dim rs as New ADODB.Recordset
      Set rs=New ADODB.Recordset
      rs.open"select * from 年检表 where 年检时间 between #" & CDate(DTPicker1.Value) & "# and #" & CDate(DTPicker2.Value) & "#""
      

  5.   

    如果数据库是Access的话需要加#,sqlserver的话就加单引号就可以了。