Results 1 to 7 of 7
  1. #1
    Join Date
    Nov 2004
    Posts
    5

    Exclamation Unanswered: Crystal Report Text box issues

    Hi,
    I'm creating a very simple application. The user enters in information into text boxes and calculates these fields. I need to print a report with this information, but I can't figure out how to take this information and put it into the report. I have a couple of books on Crystal reports, but there's not any information on how to do this. Someone PLEASE HELP ME--I've been stuck on this for 5 days now!

  2. #2
    Join Date
    Jan 2004
    Location
    Jersey, UK
    Posts
    108
    Where does the user input into the textboxes? A VB app? MS Access?

    Wherever the textboxes are can be called your data source. Crystal needs to know where the data source is so you can use and report that data. If you're creating a new report then use the report wizard and click on the database button to search for your data source. Note: you may need to set up an ODBC connection if your data source is not in the list!

    Hope this helps.

    Regards - Andy

  3. #3
    Join Date
    Nov 2004
    Posts
    5
    Thanks for getting back with me...

    I am using a VB app for the user to input the data on a windows form. The user clicks on a button called "View Report" and I need to have the data typed by the user in the text boxes on the form to be displayed on the report. I've found some info on the TextObject object and tried to code something in the "View Report" click event; however, the text in my text boxes is not being displayed in the TextObjects on the report. What i read about the TextObject is that it is a read only, so I'm assuming that is why i cannot get the text to display in the TextObject on the report. The following is my brief snippet of code in the click event:

    Dim SchoolTaxReport As New CrystalReport1
    Dim toState As TextObject

    Private Sub cmdReport_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdReport.Click
    toState = SchoolTaxReport.ReportDefinition.ReportObjects("tx tState2")
    toState.Text = txtState.Text
    frmSchoolTaxReport.ShowDialog()
    End Sub


    Thanks for getting back with me.

  4. #4
    Join Date
    Jan 2004
    Location
    Jersey, UK
    Posts
    108
    I'm not sure if you know this or not but you can create your own parameters in Crystal. These parameters will appear in a dialog window whenever the report is run and will ask the user to input or select from a list - you can specify the list and provide defaults, etc. This would seem an easier option to me than creating a dialog form in VB and you would only have to create a button in your VB app to open the report. Crystal would do the rest!
    To insert parameters into a Crystal report, go: Insert, Field Objects, and click on Parameters; now click the New button and complete the Wizard. To include the parameters on your report just drag and drop the parameters from the Field Explorer (Insert, Field Objects) onto your report. You can even create a new Text Object in Crystal and then mix up words and fields together, e.g. "Report of " [your field] " for the year of " [your field]" inside one Text Object.
    One other thing you could try is just to see if your parameters are in the Field Explorer (Insert, Field Objects) in Crystal. Just drag these onto your report if you want them to display.
    Let me know if this helps or not as I might have mis-interpreted your problem.

    Regards - Andy

  5. #5
    Join Date
    Nov 2004
    Posts
    5
    Yes, I do realize that you can use the parameter fields; however, i have about 50 fields that the user will be inputting data. I just don't feel that this is feasible; plus, there's a certain layout that my boss wants so that it will match the paper forms that he's getting the data from. I did find some helpful information from the Crystal Decisions website(www.businessobjects.com) that I'm working with right now. I've made use of the CrystalDecisions.CrystalReports.Engine namespace which opens up a lot of uses of the report objects from the report. But now i'm getting an error saying:

    "An unhandled exception of type 'System.NullReferenceException' occurred in School Tax Rates.exe

    Additional information: Object reference not set to an instance of an object."


    You know, if it's not one thing, it's another. Thanks for your help. If you'd like to take a look at my code at this point, I'd be more than glad to show it to you.

    Steph

  6. #6
    Join Date
    Jan 2004
    Location
    Jersey, UK
    Posts
    108
    I see. Alas it's been a while since I did any VB coding and even then I was a novice so I won't be of any help with your code. I've listed below a few other forums I use; maybe you'll have some luck there:

    http://www.experts-exchange.com/
    http://www.visualbasicforum.com/
    http://www.tek-tips.com/
    http://www.microsoft.com/technet/


    Regards - Andy

  7. #7
    Join Date
    Nov 2004
    Posts
    5
    I have figured out how to do this for anyone interested. The following code and commentary should help:

    Imports CrystalDecisions.CrystalReports.Engine
    Imports CrystalDecisions.Windows.forms
    Imports CrystalDecisions.ReportSource
    Imports CrystalDecisions.Shared

    Public Class frmSchoolTaxRates

    'Define the text object from the report
    Dim toTaxYear as TextObject
    Dim SchoolTaxReport As New crSchoolTaxReport
    'where crSchoolTaxReport is the name of the crystal report

    Private Sub cmdReport_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdReport.Click

    Me.FillTextObjects()
    End Sub

    Public FillTextObjects()
    toTaxYear = SchoolTaxReport.ReportDefinition.ReportObjects("tx tTaxYear2")
    'where txtTaxYear2 is the name of the text object on the report

    'Set the form's text fields to the report's text objects
    toTaxYear.Text = txtTaxYear.Text 'where txtTaxYear is the name of the text box on the windows form

    frmSchoolTaxReport.CrystalReportViewer1.ReportSour ce = SchoolTaxReport
    frmSchoolTaxReport.ShowDialog()
    End Sub
    End Class
    Last edited by sgreenwell; 11-29-04 at 13:05.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •