因为整个代码还有包含打印的代码,所以我将全部代码贴上:
Dim Filter As String
With e.Form.Controls("DDH")
If .Value IsNot Nothing Then
Filter = "IO = '" & .Value & "'"
End If
End With
With e.Form.Controls("KA")
If .Value IsNot Nothing Then
If Filter > "" Then
Filter = Filter & " And "
End If
Filter = Filter & "口岸 = '" & .Value & "'"
End If
End With
With e.Form.Controls("ys")
If .Value IsNot Nothing Then
If Filter >"" Then
Filter = Filter & " And "
End If
Filter = Filter & "运输方式 = '" & .Value & "'"
End If
End With
With e.Form.Controls("bz")
If .Value IsNot Nothing Then
If Filter >"" Then
Filter = Filter & " And "
End If
Filter = Filter & "包装= '" & .Value & "'"
End If
End With
If Filter > "" Then
Tables("装箱单").Filter = Filter
Tables("订箱单").Filter =tables("装箱单").Filter
Tables("出运资料").Filter =tables("装箱单").Filter
Tables("装箱统计").Filter =tables("装箱单").Filter
Tables("裁剪数").Filter =tables("装箱单").Filter
End If
Tables("装箱单").Sort = "开始箱号"
Dim T10 As String = e.Form.Controls("DDH").Value
Dim T20 As String = e.Form.Controls("KA").Value
DataTables("装箱统计").LoadFilter = "[IO] = '"& T10 &"'and [口岸] = '"& T20 &"'"
DataTables("装箱统计").Load()
DataTables("出运资料").LoadFilter = "[IO] = '"& T10 &"'and [口岸] = '"& T20 &"'"
DataTables("出运资料").Load()
DataTables("订箱单").LoadFilter = "[IO] = '"& T10 &"'and [口岸] = '"& T20 &"'"
DataTables("订箱单").Load()
DataTables("裁剪数").LoadFilter = "[IO] = '"& T10 &"'and [口岸] = '"& T20 &"'"
DataTables("裁剪数").Load()
With Tables("装箱单")
.Select(0,0, .Rows.Count - 1, .Cols.Count - 1)
End With
Dim T,T1,T2 As String
T = e.Form.Controls("ComboBox5").value
T1 = ProjectPath & "Attachments\" & T & ".xls"
T2 = ProjectPath & "Reports\ "& T & ".xls"
if T ="" then
MessageBox.Show("请输入报表名!")
Else
Dim Book As New XLS.Book(T1)
Book.Build() '生成细节区
Book.Save(T2)
Dim Proc As New Process
Proc.File = T2
Proc.Start()
End if