|
用刘小军查询;能结合,文本框选择 为空 or 不为空,和< ,>,=,<> 数字吗?怎样结合!!
Dim strWhere As String
Dim lngLen As Long
Const conJetDate = "\#yyyy\/mm\/dd\#"
If Not IsNull(Me.A) Then
strWhere = strWhere & "([字段] like '*" & Me.A & "*') AND "
End If
If Not IsNull(Me.B) Then
strWhere = strWhere & "([字段] like '*" & Me.B & "*') AND "
End If
If Not IsNull(Me.C) Then
strWhere = strWhere & "([日期] >= " & Format(Me.C, conJetDate) & ") AND "
End If
If Not IsNull(Me.D) Then
strWhere = strWhere & "([日期] <= " & Format(Me.D, conJetDate) & ") AND "
End If
lngLen = Len(strWhere) - 5
If lngLen <= 0 Then
窗体.Form.FilterOn = False
Else
strWhere = Left$(strWhere, lngLen)
窗体.Form.Filter = strWhere
窗体.Form.FilterOn = True
end if
|
|