以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  打印选择条件  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=80103)

--  作者:woshiabc
--  发布时间:2016/1/16 10:47:00
--  打印选择条件
 这里的条件没有起限制作用,可以帮我改改吗,通过选择报价日期和名称来选择打印记录
Dim ww As String =e.Form.Controls("ComboBox1").Value
Dim rq As Date = e.Form.Controls("DateTimePicker1").Value

Dim Book As New XLS.Book(ProjectPath & "Attachments\\报价表.xls") \'打开模板
Dim fl As String = ProjectPath & "Reports\\报价表.xls"
Dim Sheet As XLS.Sheet = Book.Sheets(0)
Dim Filter As String

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
With e.Form.Controls("ComboBox1")
    If .Value IsNot Nothing Then
        If Filter > "" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & "旺旺QQ = \'" & .Value & "\'"
    End If
End With

If filter > "" Then
    Sheet(3,19).Value = "<" & filter & ">"
Else
    Sheet(3,19).Value = "<all>"
End If
Book.Build() \'生成报表
Book.Save(fl)
Dim Proc As New Process
Proc.File = fl
Proc.Start()
[此贴子已经被作者于2016/1/16 10:58:23编辑过]

--  作者:Hyphen
--  发布时间:2016/1/16 11:02:00
--  
 Filter = Filter & "报价日期 = #" & format(.Value,"M/d/yyyy") & "#"   
--  作者:woshiabc
--  发布时间:2016/1/16 11:17:00
--  
 还是不行
--  作者:Hyphen
--  发布时间:2016/1/16 11:34:00
--  
直接设置要打印的表的 Filter

Tables("出库").Filter = ""

--  作者:woshiabc
--  发布时间:2016/1/16 11:42:00
--  
 意思是这样吗?
Dim ww As String =e.Form.Controls("ComboBox1").Value
Dim rq As Date = e.Form.Controls("DateTimePicker1").Value

Dim Book As New XLS.Book(ProjectPath & "Attachments\\报价表.xls") \'打开模板
Dim fl As String = ProjectPath & "Reports\\报价表.xls"
Dim Sheet As XLS.Sheet = Book.Sheets(0)
Dim Filter As String

With e.Form.Controls("DateTimePicker1")
  Tables("报价单").Filter = ""
End With
With e.Form.Controls("ComboBox1")
    If .Value IsNot Nothing Then
        If Filter > "" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & "旺旺QQ = \'" & .Value & "\'"
    End If
End With

If filter > "" Then
    Sheet(3,19).Value = "<" & filter & ">"
Else
    Sheet(3,19).Value = "<all>"
End If
Book.Build() \'生成报表
Book.Save(fl)
Dim Proc As New Process
Proc.File = fl
Proc.Start()
--  作者:Hyphen
--  发布时间:2016/1/16 11:50:00
--  

Dim Filter As String

With e.Form.Controls("DateTimePicker1")
    If .Value IsNot Nothing Then
        If Filter > "" Then
            Filter = Filter & " And "
        End If       
        Filter = Filter & "报价日期 = \'" & .Value & "\'"   
        \'Filter = Filter & "报价日期 = #" & .Value & "#"   \'如果是内部表
 End If
End With
With e.Form.Controls("ComboBox1")
    If .Value IsNot Nothing Then
        If Filter > "" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & "旺旺QQ = \'" & .Value & "\'"
    End If
End With

Tables("报价单").Filter = Filter 

Dim Book As New XLS.Book(ProjectPath & "Attachments\\报价表.xls") \'打开模板
Dim fl As String = ProjectPath & "Reports\\报价表.xls"
Book.Build() \'生成报表
Book.Save(fl)
Dim Proc As New Process
Proc.File = fl
Proc.Start()


--  作者:woshiabc
--  发布时间:2016/1/16 13:10:00
--  
 可以不要对表格进行选择,只在打印的EXCEL版面显示吗
--  作者:woshiabc
--  发布时间:2016/1/16 13:24:00
--  
 
图片点击可在新窗口打开查看想在这里自动生成厚度*长度*宽度+信封口规格单位
就是0.06*54*56+6CM这样的形式要怎么做呢?

--  作者:大红袍
--  发布时间:2016/1/16 16:22:00
--  
不会做,请上传具体的例子。