Results 1 to 16 of 16

Thread: how to pass text box value to report

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    May 2005
    Posts
    278

    how to pass text box value to report

    hi all,

    i want to pass the text box value from the VB6 form to crystal report. am using cystal report 8.0. please help me it is urgent.....


    saj

  2. #2
    Frenzied Member
    Join Date
    Aug 2006
    Location
    India, Punjab, Bhatinda
    Posts
    1,689

    Re: how to pass text box value to report

    I am not sure about CR8. In CR9 you can simply pass sql to the queryString method.
    vb Code:
    1. Dim appln As New CRAXDDRT.Application
    2. Dim Report As New CRAXDDRT.Report
    3. Private Sub Form_Load()
    4.     Set Report = appln.OpenReport(Location of your reportfile & "\reportname.rpt")
    5.     Report.Database.Tables(1).Location = Location of your database & "\databasename.mdb"
    6.  
    7.   Report.SQLQueryString = SQL
    8.     CRViewer91.ReportSource = Report
    9.     CRViewer91.ViewReport
    10. End Sub
    Include the reference to CRviewer Control 9

  3. #3
    Hyperactive Member nUflAvOrS's Avatar
    Join Date
    Jul 2007
    Location
    Malaysia/ Currently at Singapore
    Posts
    372

    Re: how to pass text box value to report

    You can try add a formula fields to Crystal Report

    if you are using crystal report control component

    try this

    vb Code:
    1. With crystalreportCtrl
    2.     .reset
    3.     .Datafiles(0) = -- your database path --
    4.     .ReportFileName = -- your crystalreport path --
    5.    .Formulas(0) = "YourFormulaName = '" & textbox1.text & "'"
    6.    .Action = 1
    7.  
    8. end with
    Where there is no hope, there can be no endeavor.

    There are two ways of rising in the world, either by your own industry or by the folly of others.

  4. #4

    Thread Starter
    Hyperactive Member
    Join Date
    May 2005
    Posts
    278

    Re: how to pass text box value to report

    it is not working with CR8.

  5. #5
    Frenzied Member
    Join Date
    Jul 2007
    Posts
    1,306

    Re: how to pass text box value to report

    Use a parameter field

    Code:
    Reports.ParameterFields(0) = "paramName;" & text1.text & ";true"
    Note: This is using the ReportViewer Component. But I think the concept is same.
    Parameters are accessed by thier index
    .ParameterFields(0)
    And the order has to be the EXACT order in the report.
    Last edited by zeezee; Oct 3rd, 2007 at 03:35 AM. Reason: typo
    IIF(Post.Rate > 0 , , )

  6. #6
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: how to pass text box value to report

    Moved to reporting

  7. #7

    Thread Starter
    Hyperactive Member
    Join Date
    May 2005
    Posts
    278

    Re: how to pass text box value to report

    hi guys,

    still i didnot get the result. any suggestions. i try all the way u people suggested. but still the value is not coming to the report. please help in this regards


    saj

  8. #8
    Frenzied Member
    Join Date
    Jul 2007
    Posts
    1,306

    Re: how to pass text box value to report

    Could you post your code please. And if possible, the report also.
    The parameter field works well with reports. If you use a parameter field, if thats not passed, the report viewer it self would prompt to that.
    What are you using, Report Viewer control or Crystal Report component?
    IIF(Post.Rate > 0 , , )

  9. #9

    Thread Starter
    Hyperactive Member
    Join Date
    May 2005
    Posts
    278

    Re: how to pass text box value to report

    Quote Originally Posted by zeezee
    Could you post your code please. And if possible, the report also.
    The parameter field works well with reports. If you use a parameter field, if thats not passed, the report viewer it self would prompt to that.
    What are you using, Report Viewer control or Crystal Report component?
    am using crystal report component. tomorrrow only i can post u my code.

  10. #10
    Frenzied Member
    Join Date
    Jul 2007
    Posts
    1,306

    Re: how to pass text box value to report

    Quote Originally Posted by sajankk
    am using crystal report component. tomorrrow only i can post u my code.
    in CR Component it shoud be like this.

    Assume your report source name is m_Report

    Code:
    m_Report.ParameterFields(1).AddCurrentValue "testValue"
    IIF(Post.Rate > 0 , , )

  11. #11
    New Member
    Join Date
    Oct 2007
    Posts
    7

    Re: how to pass text box value to report

    Hi ,

    i want to pass two values that is Date from form to Datareport as parameter to command where the command is.
    SELECT * FROM DD where date_col_1 <= DD_DATE and date_col_2 >= DD_DATE

  12. #12
    Member
    Join Date
    Nov 2006
    Posts
    38

    Re: how to pass text box value to report

    Quote Originally Posted by bhamres
    Hi ,

    i want to pass two values that is Date from form to Datareport as parameter to command where the command is.
    SELECT * FROM DD where date_col_1 <= DD_DATE and date_col_2 >= DD_DATE

    try parameters....i think it has a parameter class info back in vb 6. ofcourse you will have to have thesame name and order of parameters in both your code and report....

  13. #13
    New Member
    Join Date
    Oct 2007
    Posts
    7

    want to create an application for database

    want to create an application for database like add delete update options.
    plz can u send me the sample application or code.Actually i did for add option but i wont able to create for update and delete.How to modify particular record and delete particular record

  14. #14
    Frenzied Member
    Join Date
    Jul 2007
    Posts
    1,306

    Re: how to pass text box value to report

    What you ask is something you wont get easily in here. Here you would get answers to your problems, but I dont think any body would code for you. (I may be wrong.)
    BTW, you have to open a new thread for your problems since the OP asks about crystal reports , neither Data Base question Nor Data Reoport question.
    IIF(Post.Rate > 0 , , )

  15. #15
    Addicted Member mabbas110's Avatar
    Join Date
    Oct 2005
    Location
    Karachi , Pakistan
    Posts
    172

    Re: how to pass text box value to report

    I would prefer that you create sp and pass two parameters in parameters. That parameter will aslo come in report with the same name added "@" , after that u just need to pass report parameters from code and you can get the desired result. Let me know if my point is clear or not.
    Thanks and Regards,

    Muhammad Abbas

  16. #16
    Frenzied Member
    Join Date
    Jul 2007
    Posts
    1,306

    Re: how to pass text box value to report

    Quote Originally Posted by mabbas110
    I would prefer that you create sp and pass two parameters in parameters. That parameter will aslo come in report with the same name added "@" , after that u just need to pass report parameters from code and you can get the desired result. Let me know if my point is clear or not.
    You mean a SP in the DB? or CR?

    BTW, I wonder whether the OP has got his answer or not
    IIF(Post.Rate > 0 , , )

Posting Permissions

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



Click Here to Expand Forum to Full Width