Dim cp As WinForm.ComboBox = e.Form.Controls("product")
Dim sd As WinForm.DateTimePicker = e.Form.Controls("startDate")
Dim ed As WinForm.DateTimePicker = e.Form.Controls("EndDate")
Dim s1,s2,s3 As String
s1 = "付款时间>=#" & sd.Value & "# And 付款时间<=#" & ed.Value & "# And 订单状态='已收货' And 产品名称='" & cp.Value & "'"
s2 = "付款时间>=#" & sd.Value & "# And 付款时间<=#" & ed.Value & "# And 订单状态='已退货' And 退款时间<#" & sd.Value & "# or 退款时间>#" & ed.Value & "# And 产品名称='" & cp.Value & "'"
s3 = "退款时间>=#" & sd.Value & "# And 退款时间<=#" & ed.Value & "# And 订单状态='已退货' And 付款时间<#" & sd.Value & "# or 付款时间>#" & ed.Value & "# And 产品名称='" & cp.Value & "'"
Tables("表A").Filter = s1 & " Or " & s2 & " Or " & s3