Rss & SiteMap

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

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

标题:帮忙看以下这段代码错在哪里?

1楼
kylin 发表于:2008/10/2 11:16:00
如题,该代码是在打印按钮中的:

Dim db As DataRow=Forms("窗口1").Controls("TextBox2").BindRow.DataRow
dim f As New Filler
DataTables("bdlshz").DataRows.Clear() '清除原有数据
f.SourceTable = DataTables("bdmx")
f.SourceCols = "bwmc,clmc"
f.DataTable = DataTables("bdlshz")
f.DataCols = "bwmc,clmc"
f.Filter= "[bh]='" & db("bh") & "' and [je]> 0"
f.Fill()

Dim dr1 As DataRow
For Each dr As Datarow In DataTables("bdlshz").DataRows
    dr("dh") = DataTables("bdmx").Compute("Sum(dh)","[bh]='" & db("bh") & "' and [bwmc] = '" & dr("bwmc") & "'  and [clmc] = '" & dr("clmc") & "'")
    dr("je") = DataTables("bdmx").Compute("Sum(je)","[bh]='" & db("bh") & "' and [bwmc] = '" & dr("bwmc") & "'  and [clmc] = '" & dr("clmc") & "'")
   dr1 = DataTables("bdmx").Find("[bh]='" & db("bh") & "' and [bwmc] = '" & dr("bwmc") & "'  and [clmc] = '" & dr("clmc") & "'")
   dr("dj") = dr1("dj")
   dr("id") = dr1("id")
Next
Tables("bdlshz").Sort = "id"

Dim Book As New XLS.Book(ProjectPath & "Attachments\bjd1.xls")
Dim Sheet As XLS.Sheet = Book.Sheets(0)
Sheet(5,37).Value =Tables("bjd.bdmx").Compute("Sum(je)")
Book.Save(ProjectPath & "reports\bjd1.xls") '保存工作簿
Dim Proc As New Process '打开工作簿
Dim p as string = ProjectPath & "reports\bjd1.xls"
Proc.File =  p
Proc.Start()
发生以下错误:


图片点击可在新窗口打开查看此主题相关图片如下:01.jpg
图片点击可在新窗口打开查看
2楼
狐狸爸爸 发表于:2008/10/6 9:18:00
问题解决了吗?
可能是目标excel文件已经被打开了吧
3楼
kylin 发表于:2008/10/6 10:04:00
用今天的版本测试,还是没有解决,在没有打开任何一个Excel文件的情况下发生。
请老六关注。谢谢!
4楼
狐狸爸爸 发表于:2008/10/6 10:16:00
呵呵,请提供设计好的项目文件、excel报表模板文件,以方便我测试
5楼
kylin 发表于:2008/10/6 10:24:00

好,我做一下准备吧。

共5 条记录, 每页显示 10 条, 页签: [1]

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

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