rpt.recordselectionformula and subrpt.recordselectionformula

G

Guest

VB .NET 2002
Crystal Reports 9

Hello:
OK, I'm getting closer with this. Can someone please help with this last piece?

Main report oracle 7 db
Subreport totally unrelated historical Access .mdb

I need to take the user's input in a text box and pass the result (wildcard) to the record selection formula prior to refreshing the crystal report.

When I set the report source to the main report, I get all the results from the main report, but the subreport isn't being read correctly.

When I set the report source to the subreport, I get results in the subreport, I only get results in the subreport.

Makes sense, right?

But I NEED results in both whenever they exist.

How do I have the report source look at both reports? Or whatever I need to do to get results from both?

I'd really appreciate your feedback!


In Public Class:

Dim rpt As New CBOPARTSDESCFORMULA2()
Dim subrpt As New ReportDocument()


Here's the code in my display click button:

Dim mySubReport As CrystalDecisions.CrystalReports.Engine.ReportDocument
Dim mySubReportObject As CrystalDecisions.CrystalReports.Engine.SubreportObject
Dim MyReportObject As CrystalDecisions.CrystalReports.Engine.ReportObject

CrystalReportViewer1.ReportSource = rpt

Dim RecordSelectionFormula As String
Dim reportName As String

CrystalReportViewer1.SelectionFormula = RecordSelectionFormula

CrystalReportViewer1.RefreshReport()

If I change the report source = subrpt or reportdocument, I get results in the subreport.

What's the missing piece, please?

Thanks so much!

Helen
 
G

Guest

Now, we're getting somewhere, I'm getting results in the subreport with this code, but for some reason it's bypassing the selection formula for the main report. Does anyone know what's wrong here, please?
==========
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDisplay.Click

Dim SelectFormula As String()
Dim reportName As String

subrpt = CBOPARTSDESCFORMULAReport.OpenSubreport("itemdesc")

CBOPARTSDESCFORMULAReport.RecordSelectionFormula = SelectFormula("LowerCase({LINE_ITEM.CLIN_DESC}) LIKE '" & txtDesc().Text.ToLower & "' or LowerCase({LINE_ITEM.CLIN_EXT_DESC}) LIKE '" & txtDesc().Text.ToLower & "' or LowerCase({PROC_OBJECT_1.DOC_TITLE}) LIKE '" & txtDesc().Text.ToLower & "'")

CrystalReportViewer1.RefreshReport()
End Sub

Tks,
-H
 
G

Guest

Well, here's the answer. Just need to add the following prior to refreshreport:

CrystalReportViewer1.ReportSource = CBOPARTSDESCFORMULAReport

Had it misplaced in the pub class.

So, this one's done.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top