小成 发表于:2020-08-03 23:26:53
设计了一个filter的查询,是日期+复选框的,但是这个复选框的部份,写了很多次都没成功。请高手高手帮忙看看。
附件
Private Sub Command9_Click()
Dim strWhere As String '定义条件字符串
If Not IsNull(Me.开始日期) Then
strWhere = strWhere & "([CreatedDate] >= #" & Me.开始日期 & "#) AND "
End If
If Not IsNull(Me.截止日期) Then
strWhere = strWhere & "([CreatedDate] <= #" & Me.截止日期 & "#) AND "
End If
If Me.Paid.Value = "-1" Then
strWhere = strWhere & "[Pay(Yes/No)]=TRUE AND """
End If
If Me.Unpaid.Value = "-1" Then
strWhere = strWhere & "[Pay(Yes/No)]=FALSE AND """
End If
If Len(strWhere) > 0 Then
strWhere = Left(strWhere, Len(strWhere) - 5)
End If
Debug.Print strWhere
Dim stDocName As String
stDocName = "Test"
DoCmd.OpenForm stDocName
Forms!Test.Form.Filter = strWhere
Forms!Test.Form.FilterOn = True
End Sub
strWhere = strWhere & "[Pay(Yes/No)]=TRUE AND """=》请问一下,为什么后面还要加多两个""呢?
总记录:2篇 页次:1/1 9 1 :