代码如下:
Private Sub qryRec_Click()
Dim strWhereDate As String
strWhereDate = " [riqi] >=" & getFirstDayOfMonth() & " and [riqi] <= " & Date
Me.lstResult.RowSource = _
"SELECT * FROM tblA where " & strWhereDate
end Sub
getFirstDayOfMonth() 返回出来是date型的值
debug出来的SQL语句:
SELECT * FROM tblA where [riqi] >= 2008-06-01 and [riqi] >= 2008-06-23