Dim Rs As Recordset
Set Rs = New ADODB.Recordset
Rs.CursorLocation = adUseClient
Rs.Open "select * from 表名 where 日期>=#" 开始时间 "# AND 日期<#" & 结束时间 & "# , cnCnn, adOpenStatic, adLockOptimistic, adCmdText
' cnCnn(是数据库)
If Rs.RecordCount > 0 Then
…………………
End If
Rs.Close
Set Rs = Nothing