本文介绍了水晶子报告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hello All,

我遇到了Crystal子报告问题。问题是我不知道如何在VB 2005中将子报表添加到主报表中(VB6更容易!)。谁能告诉我如何将子报表链接到主报表。我已经为主报告创建了公共变量( Public rptDoc As ReportDocument)。我还添加了 Imports CrystalDecisions.CrystalReports.Engine to我的主模块的顶部,允许访问其对象和属性。我注意到rptDoc确实有一个子报告选项,但我不知道如何使用它。以下是我将用于主报告的代码示例。此示例的子报表将被称为 My .Application。 Info.DirectoryPath& " \Prolinksubform.rpt"。


Hello All,

I am having a Crystal subreport problem.  The problem is that I do not know how to add the subreport to the main report in VB 2005 (VB6 was much easier!).  Could anyone please tell me how to link the subreport to the main report.  I have already created the public variable for the main report (Public rptDoc As New ReportDocument).  I have also added the Imports CrystalDecisions.CrystalReports.Engine to the top of my main module to allow access to its objects and properties.  I noticed that rptDoc does have a subreports option but I am not sure how to use it.  Here is a sample of the code that I would use for the main report.  My subreport for this example would be called  My.Application.Info.DirectoryPath & "\Prolinksubform.rpt".













































rsReports.Close()
rsReports.CursorLocation = ADODB 。CursorLocationEnum.adUseClient
rsReports.Open(" P_ProlinkReques('" &安培; Text1.Text&安培; "'')",cnLoad,ADODB.CursorTypeEnum.adOpenKeyset,ADODB.LockTypeEnum.adLockBatchOptimistic,ADODB.CommandTypeEnum.adCmdStoredProc)
'SubReport Data
rsSubReports.Close()
rsSubReports.CursorLocation = ADODB 。CursorLocationEnum.adUseClient
rsSubReports.Open(" P_MaterialTransferID('"& Text1.Text&"')",cnLoad,ADODB.CursorTypeEnum.adOpenKeyset,ADODB .LockTypeEnum.adLockBatchOptimistic,ADODB.CommandTypeEnum.adCmdStoredProc)
rsRe ports.Requery()
rsSubReports.Requery()
如果 cmbInventoryChange.Text = " No" 然后
rptDoc.Load(My.Application。 Info.DirectoryPath&安培; " \ ProLinkRequest.rpt")
rptDoc.SetDataSource(rsReports)
ElseIf cmbInventoryChange.Text = "是" 然后
rptDoc.Load (My.Application.Info.DirectoryPath&" \ ProLinkRequest with Materials.rpt")
结束如果
frmCrystalView.Show()
        rsReports.Close()  
        rsReports.CursorLocation = ADODB.CursorLocationEnum.adUseClient  
        rsReports.Open("P_ProlinkReques('" & Text1.Text & "')", cnLoad, ADODB.CursorTypeEnum.adOpenKeyset, ADODB.LockTypeEnum.adLockBatchOptimistic, ADODB.CommandTypeEnum.adCmdStoredProc)  
        'SubReport Data  
        rsSubReports.Close()  
        rsSubReports.CursorLocation = ADODB.CursorLocationEnum.adUseClient  
        rsSubReports.Open("P_MaterialTransferID('" & Text1.Text & "')", cnLoad, ADODB.CursorTypeEnum.adOpenKeyset, ADODB.LockTypeEnum.adLockBatchOptimistic, ADODB.CommandTypeEnum.adCmdStoredProc)  
 
        rsReports.Requery()  
        rsSubReports.Requery()  
 
        If cmbInventoryChange.Text = "No" Then  
            rptDoc.Load(My.Application.Info.DirectoryPath & "\ProLinkRequest.rpt")  
            rptDoc.SetDataSource(rsReports)  
 
        ElseIf cmbInventoryChange.Text = "Yes" Then  
            rptDoc.Load(My.Application.Info.DirectoryPath & "\ProLinkRequest with Materials.rpt")  
              
        End If  
        frmCrystalView.Show() 

推荐答案


这篇关于水晶子报告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-11 08:05