应该这样
rs.open "select * from table where dyrq<='" & dtpicker1.value & "' and dyrq >='" & dtpicker2.value &"'",.......

解决方案 »

  1.   

    rs.open "select * from table where dyrq<=" & dtpicker1.value & " and dyrq >= " & dtpicker2.value & "",cn,...
      

  2.   

    你用什么数据库?
    不同的数据库语法不一样
    DYRQ是什么类型?
    不同的类型处理不一样
      

  3.   

    如果你的SQL语句有变量,请把SQL语句放在一个 字符串变量中.
    比如:
       dim sc as string
       sc ="select * from table where Field_A ='" & text1.text & "'"
       rs.open sc,cn
      

  4.   

    我用的是Access数据库,dyrq是日期/时间类型.若用SQL会如何写呢?
      

  5.   

    如用Access数据库应该这样
    rs.open "select * from table where dyrq<=#" & dtpicker1.value & "# and dyrq >=#" & dtpicker2.value &"#",....... 
      

  6.   

    用charise(VB恐怖分子)的方法是最好加上format的调用,
    如format(dtpicker1.value,"yyyy/MM/dd")