Dim Filter As String
With e.Form.Controls("ComboBox1")
If .Value IsNot Nothing Then
Filter = "当班班级 = '" & .Value & "'"
End If
End With
With e.Form.Controls("ComboBox2")
If .Value IsNot Nothing Then
If Filter > "" Then
Filter = Filter & " And "
End If
Filter = Filter & "当班班次 = '" & .Value & "'"
End If
End With
With e.Form.Controls("DateTimePicker1")
If .Value IsNot Nothing Then
If Filter >"" Then
Filter = Filter & " And "
End If
Filter = Filter & " 日期= '" & .Value & "'"
End If
End With
If Filter > "" Then
Tables("调度交接班表_Table1").Filter = Filter
Tables("调度交接班表_Table2").Filter = Filter
Tables("调度交接班表_Table3").Filter = Filter
Tables("调度交接班表_Table4").Filter = Filter
Tables("调度交接班表_Table5").Filter = Filter
Tables("调度交接班表_Table6").Filter = Filter
Tables("调度交接班表_Table7").Filter = Filter
End If
If Filter > "" Then
Tables("调度交接班表_Table1").DataTable.loadFilter = Filter
Tables("调度交接班表_Table1").DataTable.load
Tables("调度交接班表_Table2").DataTable.loadFilter = Filter
Tables("调度交接班表_Table2").DataTable.load
Tables("调度交接班表_Table3").DataTable.loadFilter = Filter
Tables("调度交接班表_Table3").DataTable.load
Tables("调度交接班表_Table4").DataTable.loadFilter = Filter
Tables("调度交接班表_Table4").DataTable.load
Tables("调度交接班表_Table5").DataTable.loadFilter = Filter
Tables("调度交接班表_Table5").DataTable.load
Tables("调度交接班表_Table6").DataTable.loadFilter = Filter
Tables("调度交接班表_Table6").DataTable.load
Tables("调度交接班表_Table7").DataTable.loadFilter = Filter
Tables("调度交接班表_Table7").DataTable.load
End If
Relations.Add("关联1",DataTables("调度交接班表_Table1").DataCols("日期"),DataTables("调度交接班表_Table3").DataCols("日期"))
Relations.Add("关联2",DataTables("调度交接班表_Table1").DataCols("日期"),DataTables("调度交接班表_Table2").DataCols("日期"))
Relations.Add("关联3",DataTables("调度交接班表_Table1").DataCols("日期"),DataTables("调度交接班表_Table4").DataCols("日期"))
Relations.Add("关联4",DataTables("调度交接班表_Table1").DataCols("日期"),DataTables("调度交接班表_Table5").DataCols("日期"))
Relations.Add("关联5",DataTables("调度交接班表_Table1").DataCols("日期"),DataTables("调度交接班表_Table6").DataCols("日期"))
Relations.Add("关联6",DataTables("调度交接班表_Table1").DataCols("日期"),DataTables("调度交接班表_Table7").DataCols("日期"))