Avatar of wiswalld
wiswalldFlag for United States of America

asked on 

Open Crystal Report to current record

I am using VS 2005 with crystal reports. I have created a crystal report based on an xml database using a wizard. I have added all my fields to a blank report. I want to open the report from a form but only show the current record based on two fields (txtCourseName and RDate). How do I open the report from a form based on my two form fields?
Visual Basic.NETCrystal Reports

Avatar of undefined
Last Comment
wiswalld
Avatar of Bob Learned
Bob Learned
Flag of United States of America image

I am confused--what is the data source for the report?
Avatar of wiswalld
wiswalld
Flag of United States of America image

ASKER

XML File. This is totally new to me working with Crystal reports. Basically I followed the post I found here

http://www.developersdex.com/gurus/articles/603.asp

I then added my fields to the report. Everything works fine. But I only want to show a certain record in the report now not all the records.

:)

Dave
Avatar of wiswalld
wiswalld
Flag of United States of America image

ASKER

Sorry for all the posts. I feel like I am trying to learn this here. I have searched the internet for some cheap online classes for VB.Net and so forth but really have found nothing.
Avatar of wiswalld
wiswalld
Flag of United States of America image

ASKER

I am in the process of learning VB. Normally use Access.
Avatar of Bob Learned
Bob Learned
Flag of United States of America image

If you went through the report designer, you would see the Filter Fields, which you can use to filter the data.
Crystal-Report-Wizard----Filter-.png
Avatar of wiswalld
wiswalld
Flag of United States of America image

ASKER

I was going at it from the select expert. Choosing my field equal to .... but there is no option for a form field. I just get an option to do it like this

{tblRound.Course} = "Thomas Carvel Country Club"

That works to only show that record but I may not always want that record.
Avatar of Bob Learned
Bob Learned
Flag of United States of America image

How would you know what "current record" is?
Avatar of wiswalld
wiswalld
Flag of United States of America image

ASKER

What I want to do is reference a textbox on a form to get the value. So I was thinking

{tblRound.Course} = frmRoundAdd.txtCourse.text
Avatar of Bob Learned
Bob Learned
Flag of United States of America image

Add a parameter to the Crystal Report, and then pass in the TextBox.Text to the parameter, and use that for the filter criteria.
Avatar of wiswalld
wiswalld
Flag of United States of America image

ASKER

That was were I got started. I thought that was the way to go but I wasn't sure what to put for Prompting Text or how to pass the parameter.
Avatar of Bob Learned
Bob Learned
Flag of United States of America image

Show me how you are working with the report, and I can show how you should solve this problem.
Avatar of wiswalld
wiswalld
Flag of United States of America image

ASKER

I right click the report and select report - select expert
report.JPG
Avatar of wiswalld
wiswalld
Flag of United States of America image

ASKER

Or for the parameter


report1.JPG
Avatar of Bob Learned
Bob Learned
Flag of United States of America image

No, I meant how you are displaying the report.  Are you doing that through code or the designer?
Avatar of wiswalld
wiswalld
Flag of United States of America image

ASKER

I have simply designed the report and I open with a button. Shows how dumb I am I am not exactly sure what you mean. I think you mean do I use code to open the report. Then no. The wizard created all connections for me and populates the fields I added to the report. I have since created a parameter and added to the report. I have then set the Course name to equal that parameter. But I am prompted for a discrete value when opening the report. The report will populate fine if I enter a value.
Avatar of Bob Learned
Bob Learned
Flag of United States of America image

I think that you need to choose a different direction.

Example:


    Private Sub ShowAuditReport(ByVal auditID As Integer)
        Dim report As New AuditReport()
        Dim ds As DataSet = DataLayer.GetAudit(auditID)
        report.SetDataSource(ds)
        report.SetParameterValue("Auditor", "Bob")
 
        Me.ReportViewer.ReportSource = report
 
    End Sub

Open in new window

Avatar of wiswalld
wiswalld
Flag of United States of America image

ASKER

How does this work. I did a little tweaking and this seems to work

Dim report As New rptScoreCard
        Dim ds As New DataSet()
        ds.ReadXml("C:\DVADGOLF\tblPlayer.xml")
        report.SetDataSource(ds)
        report.SetParameterValue("Course", frmRoundAdd.txtCourse.Text)

        Me.CrystalReportViewer1.ReportSource = report
ASKER CERTIFIED SOLUTION
Avatar of Bob Learned
Bob Learned
Flag of United States of America image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of wiswalld
wiswalld
Flag of United States of America image

ASKER

Thank You.
Visual Basic.NET
Visual Basic.NET

Visual Basic .NET (VB.NET) is an object-oriented programming language implemented on the .NET framework, but also supported on other platforms such as Mono and Silverlight. Microsoft launched VB.NET as the successor to the Visual Basic language. Though it is similar in syntax to Visual Basic pre-2002, it is not the same technology,

96K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo