Dim Filter As String
With e.Form.Controls("起始时间")
If .Value IsNot Nothing Then
If Filter >"" Then
Filter = Filter & " And "
End If
Filter = Filter & "日期 >= #" & .Value & "#"
End If
End With
With e.Form.Controls("结束时间")
If .Value IsNot Nothing Then
If Filter >"" Then
Filter = Filter & " And "
End If
Filter = Filter & "日期 <= #" & .Value & "#"
End If
End With
Dim ch As WinForm.ComboBox = e.Form.Controls("车号")
Dim cy As WinForm.ComboBox = e.Form.Controls("承运")
Dim ty As WinForm.ComboBox = e.Form.Controls("托运")
Dim sh As WinForm.ComboBox = e.Form.Controls("审核开piao")
Dim hwmc As WinForm.ComboBox = e.Form.Controls("货物名称")
Dim hd As WinForm.ComboBox = e.Form.Controls("回单")
Dim xj As WinForm.ComboBox = e.Form.Controls("现金")
Dim qd As WinForm.ComboBox = e.Form.Controls("ComboBox1")
Dim zd As WinForm.ComboBox = e.Form.Controls("ComboBox2")
Tables("应付应收录入").Filter = "托运单位 = '" & ty.Text & "' And 车号 = '" & ch.Text & "' And 承运单位 = '" & cy.Text & "'"
按照一个条件或同时几个条件都能查询,最后一句过滤条件的代码应该怎么写?