这个问题在很多论坛里边都有问到。但是一直没找到满意的答案。下边写出一个解决办法 Dim sql As String Dim rstLiuShui As New ADODB.Recordset Dim Rpt As New CRAXDDRT.Report Dim PrintApp As New CRAXDDRT.Application If Option2.Value = True Then sql = "select * from n_ihbill where datediff(d,日期,''''" & Format(DTPicker1.Value, "yyyy-MM-dd") & "'''')=0 and 住院号=" & cbopatient.ItemData(cbopatient.ListIndex) Else sql = "select * from n_ihbill where datediff(d,日期,''''" & Format(DTPicker1.Value, "yyyy-MM-dd") & "'''')=0" End If Debug.Print sql