给你一个建议:
在明细报表的格式化过程中,设置是显示3条横线或4条横线,具体例子在论坛中可搜索作者: Danny.Chu 时间: 2007-9-11 21:43
实例已做好并可以运行,上面提到的过程是程序运行的流程.
主要想知道在一楼提到的思路是否可行,并借此机会向大家学习.作者: liwen 时间: 2007-9-11 22:12
你的要求应该可以实现,你应该保留适当的运行代码,和部分示例数据,这样便于别人来进行调试和判断,不然,你想让别人来造一些数据出来进行测试是否需要不少时间呢?
要么,你就在论坛上搜索有关报表的例子,你这个主要相关的应该是"报表固定行数"之类的,相信有些示例中就会有你想要的相似的代码.作者: Danny.Chu 时间: 2007-9-11 22:29
是用VB写的,并在VB里调它.
我仔细想过,A表的问题好解决
用表tblJobPRT中的字段HAVEPAGE做标记,
代码如下
Private Sub 主体_Print(Cancel As Integer, PrintCount As Integer)
If Me.HavePage = 0 Then '无明细记录时
Line306.Visible = True '显示第四条横线
Else
Line306.Visible = False
End If
End Sub
B表呢?
我要在B表的最后一页显示第四条线,用什么来判断是最后一页呢?
IF PAGE=PAGES THEN.......
但,在明细表中,记录是根据表tblAccPRT中记录数来填充的,当在多页时,要在不同页的相同位置显示不同的状态,我没有思路....作者: Danny.Chu 时间: 2007-9-11 22:33
VB中相关代码如下
Private Sub cmdPrintAll_Click()
ProgressBar1.Visible = True
ProgressBar1.Max = lstBarcode.ListCount
For I = 1 To lstBarcode.ListCount
ProgressBar1.Value = I
Label6.Caption = "第 " & lstBarcode.ListIndex + 1 & " 条/共 " & lstBarcode.ListCount & " 条"
lstBarcode.ListIndex = I - 1
If GetCustomerInfo(lstBarcode.Text) = True Then
conn.Execute "DELETE * FROM tblJobPRT"
conn.Execute "DELETE * FROM tblAccPRT"
conn.Execute "INSERT INTO tblJobPRT ( 单位账号, 序号, 所号, 条形码, 单位名称, 存款类型, 账户余额, 累计借方发生额, 累计贷方发生额, 机构名称, 机构地址, 岗位, 姓名, 办公电话, 客户地址, 邮政编码, 联系电话, 联系人, 对帐截止日期, HavePage ) " & _
"SELECT tblJobList.单位账号, tblJobList.序号, tblJobList.所号, tblJobList.条形码, tblJobList.单位名称, tblJobList.存款类型, tblJobList.账户余额, tblJobList.累计借方发生额, tblJobList.累计贷方发生额, tblJobList.机构名称, tblJobList.机构地址, tblJobList.岗位, tblJobList.姓名, tblJobList.办公电话, tblJobList.客户地址, tblJobList.邮政编码, tblJobList.联系电话, tblJobList.联系人, tblJobList.对帐截止日期, tblJobList.HavePage " & _
"From tblJobList " & _
"WHERE tblJobList.单位账号 = '" & txtAccount.Text & "'"
printCus
If HaveAtt = True Then
conn.Execute "INSERT INTO tblAccPRT ( NSN,所号, 一级支行, 二级支行, 科目号, 账号, 单位名称, 日期, 摘要, 凭证号, 对方科目, 借贷标志, 借发生额, 贷发生额, 借或贷, 余额, 复合员 ) " & _
"SELECT tblAccount.NSN, tblAccount.所号, tblAccount.一级支行, tblAccount.二级支行, tblAccount.科目号, tblAccount.账号, tblAccount.单位名称, tblAccount.日期, tblAccount.摘要, tblAccount.凭证号, tblAccount.对方科目, tblAccount.借贷标志, tblAccount.借发生额, tblAccount.贷发生额, tblAccount.借或贷, tblAccount.余额, tblAccount.复合员 " & _
"From tblAccount " & _
"WHERE tblAccount.账号 = '" & txtAccount.Text & "' ORDER BY NSN"
printAcc
End If
End If
If Check1.Value = 1 Then
If I = 10 Then Exit For
End If
Next
End Sub
Sub printCus()
Dim MSAccess As New Access.Application
MSAccess.OpenCurrentDatabase App.Path & "\whcbank.mdb"
MSAccess.DoCmd.OpenReport "new", acViewNormal
MSAccess.CloseCurrentDatabase
MSAccess.Quit
End Sub
Sub printAcc()
Dim MSAccess As New Access.Application
MSAccess.OpenCurrentDatabase App.Path & "\whcbank.mdb"
MSAccess.DoCmd.OpenReport "明细报表", acViewNormal
MSAccess.CloseCurrentDatabase
MSAccess.Quit
End Sub作者: liwen 时间: 2007-9-11 23:34
在明细的的页格式化事件中,加入
Private Sub PageHeader_Format(Cancel As Integer, FormatCount As Integer)
If [Page] <> [Pages] Then Me.Line306.Visible = False
End Sub
之类的如何?作者: liwen 时间: 2007-9-11 23:43
四条线默认为显示,当不是最后一页时,隐藏其中一条
不知你
IF PAGE=PAGES THEN.......
这个原来放在哪里,为何不行呢?作者: Danny.Chu 时间: 2007-9-12 14:37
将4条横线放在页面页眉中,将第四条横线设为不可见,然后在以下事件中加入代码:
Private Sub 页面页眉_Print(Cancel As Integer, PrintCount As Integer)
If [Page] = [Pages] Then
Line10.Visible = True '显示第四条线
End If
End Sub