问题:
'判断【RQ】条件是否有输入的值,由于有【RQKS】【RQJZ】两个文本框
'所以要分开来考虑
If Not IsNull(Me.RQKS) Then
'【RQKS】有输入
strWhere = strWhere & "([RQ] >= #" & Format(Me.RQKS, "yyyy-mm-dd") & "#) AND "
End If
If Not IsNull(Me.RQJZ) Then
'【RQJZ】有输入
strWhere = strWhere & "([RQ] <= #" & Format(Me.RQJZ, "yyyy-mm-dd") & "#) AND "
End If
正确:
'判断【RQKS】条件是否有输入的值,由于有【RQKS】【RQJZ】两个文本框
'所以要分开来考虑
If Not IsNull(Me.RQKS) Then
'【RQKS】有输入
strWhere = strWhere & "([RQKS] >= #" & Format(Me.RQKS, "yyyy-mm-dd") & "#) AND "
End If
If Not IsNull(Me.RQJZ) Then
'【RQJZ】有输入
strWhere = strWhere & "([RQKS] <= #" & Format(Me.RQJZ, "yyyy-mm-dd") & "#) AND "
End If
供参考
点击下载此附件