如果不理解代码就按照帮助的来,不要乱改
Dim filter As String = "1=1"
With e.Form.Controls("datetimepicker1")
If .value IsNot Nothing Then
filter &= " and >=#" & .value & "#"
End If
End With
messagebox.Show(filter)
With e.Form.Controls("datetimepicker2")
If .value IsNot Nothing Then
filter &= " and 入库日期<=#" & .value & "#"
End If
End With
messagebox.Show(filter)
Dim filter1 As String = "1=1"
With e.Form.Controls("textbox1")
If .value IsNot Nothing Then
filter1 &= " and 商品条码 = '" & tb1 & "'"
End If
End With
With e.Form.Controls("textbox2")
If .value IsNot Nothing Then
filter1 &= " and 订单状态 = '" & tb2 & "'"
End If
End With
messagebox.Show(filter)
Tables("订单信息_table1").filter = filter
Tables("订单信息_table2").Filter = filter1
[此贴子已经被作者于2016/12/6 14:27:38编辑过]