Rss & SiteMap

Foxtable(狐表) http://www.foxtable.com

新一代数据库软件,完美融合Access、Foxpro、Excel、vb.net之优势,人人都能掌握的快速软件开发工具!
共4 条记录, 每页显示 10 条, 页签: [1]
[浏览完整版]

标题:execel报表复选框问题

1楼
swagger 发表于:2022/8/9 21:22:00
Dim Book As New XLS.Book(ProjectPath & "Attachments\晨午检上报表.xlsx")
Dim fl As String = ProjectPath & "Reports\晨午检上报表.xlsx"
Dim s As String = ""
For Each r As Row In Tables("晨午检").GetCheckedRows
    s =s & "," & r("_Identify")
Next
s = s.Trim(",")
Tables("晨午检").Filter = "[_Identify] in (" & s & ")"
Book.Build() '生成细节区
Book.Save(fl) '保存工作簿
Dim Proc As New Process '打开工作簿
Proc.File = fl
Proc.Verb = "Print" '指定动作
Proc.Start()


勾选任意行打印没问题,但是在没有勾选行的前提下,显示错误:“语法错误: IN 关键字后面必须是由逗号分隔的非空表达式列表,并且必须用括号括起来。” 这个怎么修改呢?
2楼
有点蓝 发表于:2022/8/9 21:44:00
既然都知道原因了,就不能加个判断吗

Dim s As String = ""
dim rs as list(of row) = Tables("晨午检").GetCheckedRows
if rs.count = 0 then
msgbox("没有")
return
end if
For Each r As Row In rs
    s =s & "," & r("_Identify")
Next
s = s.Trim(",")
3楼
朱女士 发表于:2024/10/24 13:36:00
老师:您好!
  我按照您的指导意见,写的代码出现了错误信息,烦请再帮助一下。
Dim Result As DialogResult
Dim b As WinForm.TextBox = e.Form.Controls("TextBox1")
'b.BackColor = Color.Red
Dim gzh As String = b.Value
Dim Book As New XLS.Book(ProjectPath & "Attachments\生产工艺加工流程卡模板.xls")
Dim fl As String = ProjectPath & "Reports\打印工艺卡.xls"
Dim s As String = ""
Dim rs As list(Of Row) = Tables("生产计划明细表").GetCheckedRows
If rs.count = 0 Then
msgbox("没有勾选")
Return
End If
For Each r As Row In Tables("生产计划明细表").GetCheckedRows
    s = s & "," & r("_Identify")
Next
s = s.Trim(",")
Tables("生产计划明细表").Filter = "[_Identify] in (" & s & ")"
Book.Build() '生成细节区
Book.Save(fl) '保存工作簿
Dim Proc As New Process '打开工作簿
Proc.File = fl
'Proc.Verb = "Print" '指定动作
Proc.Start()
我 选中的记录和错误信息请看图片。

图片点击可在新窗口打开查看此主题相关图片如下:打印卡2.jpg
图片点击可在新窗口打开查看

4楼
有点蓝 发表于:2024/10/24 13:46:00
没有开启复选框,没有勾选:http://www.foxtable.com/webhelp/topics/1776.htm

另外自己的问题请另外发帖提问,尽量不要在别人帖里提问
共4 条记录, 每页显示 10 条, 页签: [1]

Copyright © 2000 - 2018 foxtable.com Tel: 4000-810-820 粤ICP备11091905号

Powered By Dvbbs Version 8.3.0
Processed in .02930 s, 2 queries.