hariushas
May 27th, 2004, 06:17 AM
how can i pass values from a text box to crystal report.the value is not stored in the database.please help me....
|
Click to See Complete Forum and Search --> : how can i pass values from .mdb to crystal report? hariushas May 27th, 2004, 06:17 AM how can i pass values from a text box to crystal report.the value is not stored in the database.please help me.... harmonycitra May 27th, 2004, 02:53 PM Pass it as a parameter. Create a parameter field in the report. Then pass the value for the parameter from ur interface to report in the folg. way Cr1.ParameterFields.GetItemByName("EnterOption").AddCurrentValue(ParamOption) Here EnterOption is the name of the parameter created in Crystal Reports and ParamOption contains some value which u want to pass (any value) Hope this may help hariushas May 28th, 2004, 06:15 AM Thanks , But its not working.I got an error message like this "Argument not optional". Pls explain the reason and do help me with sample code Thanks Hari harmonycitra May 28th, 2004, 10:49 AM Hope you are using VB code for creating interface -------------------------- 'In the General Declarations , declare Dim Appl As New CRAXDRT.Application Dim Report As New CRAXDRT.Report 'Assinging the report name Set Report = Appl.OpenReport("report1.rpt") Report.DiscardSavedData 'Passing the value of cmboption.Text value to the first parameter 'instead of passing by the name of the parameter, we can also use this convention Report.ParameterFields(1).AddCurrentValue cmbOption.Text 'Assigning the report source to CRViewer Control and viewing the report CRViewer1.ReportSource = Report CRViewer1.ViewReport ------------------------ If your code produces error, send the code fragment dilemma May 29th, 2004, 04:35 PM There are 3 ways to deal with this/your problem or setting/passing arguments to a report : Sample 1 --------- g_ole_crx_report.DiscardSavedData() g_ole_crx_report.ParameterFields.item[1].AddCurrentValue("100200300") Sample 2 --------- g_ole_crx_report.DiscardSavedData() g_ole_crx_report.ParameterFields[1].AddCurrentValue("100200300") Sample 3 --------- g_ole_crx_report.DiscardSavedData() g_ole_crx_report.ParameterFields.GetItemByName("@AccountNumber").AddCurrentValue("100200300") Sample 4 --------- g_ole_crx_report.DiscardSavedData() g_ole_crx_report.ParameterFields.item[3].AddCurrentValue(date("01/01/1999")) Look at this sample. It needs conversion. You need to use convert function like date (I dont' know about VB) to convert date to date format. Maybe this is what causing your problem. Thanks codeguru.com
Copyright WebMediaBrands Inc., All Rights Reserved. |