明白些了,并且写了日期的那个下拉列表,如果兼顾那四个复选框,这个逻辑判断应该怎样写?
Dim Filter As String
Dim dtp1 As WinForm.DateTimePicker = Forms("收入管理").Controls("DateTimePicker1")
Dim dtp2 As WinForm.DateTimePicker = Forms("收入管理").Controls("DateTimePicker2")
Dim cbox1 As WinForm.ComboBox = e.Form.Controls("ComboBox1")
Dim cbox2 As WinForm.ComboBox = e.Form.Controls("ComboBox2")
Dim chbox1 As WinForm.CheckBox = e.Form.Controls("C1")
Dim chbox2 As WinForm.CheckBox = e.Form.Controls("C2")
Dim chbox3 As WinForm.CheckBox = e.Form.Controls("C3")
Dim d As Date = Date.today
If chbox1.Checked =True Then
With dtp1
If .Value IsNot Nothing Then
If Filter >"" Then
Filter = Filter & " And "
End If
Filter = Filter & "日期 >= #" & .Value & "#"
End If
End With
With dtp2
If .Value IsNot Nothing Then
If Filter >"" Then
Filter = Filter & " And "
End If
Filter = Filter & "日期 <= #" & .Value & "#"
End If
End With
ElseIf chbox2.Checked =True Then
With cbox1
If .Value IsNot Nothing Then
If Filter >"" Then
Filter = Filter & " And "
End If
Filter = Filter & "收入项目 = '" & .Value & "'"
End If
End With
End If
msgbox(filter)
If Filter > "" Then
Tables("收入管理_Table1").Filter = Filter
End If