Dim dlg As New SaveFileDialog '定义一个新的SaveFileDialog
dlg.Filter= "Access文件|*.mdb" '设置筛选器
If dlg.ShowDialog = DialogResult.Ok Then '如果用户单击了确定按钮
Dim ex As New Exporter
ex.SourceTableName = "基本信息表" '指定导出表
ex.filepath = dlg.FileName '指定目标文件
ex.Filter = "列名='某值'" 怎样与下面的代码结合
ex.Export() '开始导出
End If
Dim Filter As String
With e.Form.Controls("单位查找")
If .Value IsNot Nothing Then
If Filter > "" Then
Filter = Filter & " And "
End If
Filter = Filter & "使用单位名称 like '*" & .Value & "*'"
End If
End With
With e.Form.Controls("出厂编号查找") 如果查找多个出厂编号,也可以模糊,但不确定多少,用顿号区分, 如:1003、1004、20145 代码怎样改?
If .Value IsNot Nothing Then
If Filter > "" Then
Filter = Filter & " And "
End If
Filter = Filter & "出厂编号 like '*" & .Value & "*'"
End If
End With
If Filter > "" Then
Tables("基本信息表").Filter = Filter
End If
导出为Excel格式 怎样做才能与上面导出为Access格式功能一样
Dim ex as New Exporter
ex.SourceTableName = "订单" '指定导出表
ex.FilePath = "c:\Data\订单.xls" '指定目标文件
ex.Format = "Excel" '导出格式为Excel
ex.Fields = "日期,客户,数量,单价" '指定导出字段
ex.Filter = "[产品] = 'PD01'" '指定导出条件
ex.Export() '开始导出