楼主,你的代码就差一步了。测试有效。
If e.Form.Controls("DateTimePicker1").VALUE Is Nothing = False Then
Dim Filter As String = "<[日期] = #" & e.Form.Controls("DateTimePicker1").VALUE & "#"
Dim ra1 As WinForm.RadioButton = e.Form.Controls("RadioButton1")
Dim ra2 As WinForm.RadioButton = e.Form.Controls("RadioButton2")
Dim cb As WinForm.CheckedComboBox = e.Form.Controls("CheckedComboBox1")
Dim Filter1 As String
If ra2.Checked = True Then
If cb.Value>"" Then
Dim nms() As String = cb.Value.Split(",")
For i As Integer = 0 To nms.Length - 1
filter1 &= " [客户] = '" & nms(i) & "' or "
Next
filter1 &= "1=2"
filter &= " And (" & filter1 & ")"
Else
MessageBox.show("兄弟,你还没选择要复制订单的客户!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
cb.Select()
Return
End If
End If
Dim Book As New XLS.Book(ProjectPath & "Attachments\送货单.xls") '打开模板
Dim fl As String = ProjectPath & "Reports\送货单.xls"
Dim Sheet As XLS.Sheet = Book.Sheets(0)
filter &= ">"
msgbox(filter)
Sheet(1,12).Value = filter
Book.Build() '生成报表
Book.Save(fl)
Dim Proc As New Process
Proc.File = fl
Proc.Start()
Else
MessageBox.Show("你忘记选择要复制的订单日期了哦!","^O^^O^温馨提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
e.Form.Controls("DateTimePicker1").Select()
Return
End If
e.Form.Close
[此贴子已经被作者于2013-1-22 16:29:12编辑过]