Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  HOME    TRACKER    Visual Basic

Passing Value From Form To Crystal Report


Can any body tell me how to pass the TextBox text from FORM1 to Crystal report Header section.

Thank you,

View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Passing Pwd To Crystal Report Through Code To Generate Report On Pwd-protected Db
Hi everyone.

Now, I need to pass password to a report in run-time and generate it. I am using Crystal reports 8.5 and my database (from which I intend to generate report) is db-password protected. My project works very fine after the addition of 'Jet OLEDBatabase Password=myPwd' in the open string.

Please help me as I am in the middle of nowhere. I need to have a code on opening a report by passing the pwd from code and then open it using filters users prefer.

Thanks in advance.


Passing Crystal Report Or Viewer A Value Used For Filtering The Report
I having a problem trying to filter out my crystal report based on a case number which is a primary key in my access table tblCaseInfo. I am trying to do this through so when the user is viewing a particular case they can click the print button and print only that particular case being viewed. The case number will be coming from a textbox (txtCaseNumber.text) on the form in

As of right now when the print button is clicked every case in the database is displyed in the crystal report viewer to be printed.

I have three tables involved:
tblCaseInfo - VictimID, AssailantID are foreign keys for the table listed below
tblVictimInfo - VictimID Primary Key
tblAssailantInfo-AssailantID Primary Key

Only code I have so far:

Private Sub btnPrintSurveyReport_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPrintSaveSurveyReport.Click


End Sub

Passing Parameters To A Report Via CRViewer /Crystal Report 7
hi out there,
I've got following problem: I'm working with a CRViewer to display Reports in my Progam. These Reports have Parameterfields. Normally the CRViewer displayes its own Dialog to input the Parameters. But I have to show my own Dialog in which I group parameters in a logical way. So far, so fine. This works perfect. But now I have to pass the parameters being inputed into my Dialog to the Report via CRAXDRT.Report when the OK-Button is pressed. I don't found a SetCurrentValue-Method like in CRPEAuto.Report. In the other way, if I use the method CRAXDRT.Report.ParameterFieldDefinitions.Item(index).AddCurrentValue

nothing happend. Does anyone have a hint or idea how I can write my parameters into my reports via CRAXDRT.Report.ParameterFieldDefinitions


Thanks in advance


Passing Value To A Crystal Report
hi e1...
i am using vb6 and i want to create a report using crystal reports in which when i press the button it should ask for an input for eg empno and generate a report for that empno.
thanks 4 every1's help...
with regards.

Passing A Value To A Crystal Report

I'm using VB6 to create Crystal(10) statements.

In the Crystal report, I have a Formula Field called FinancialSummary. Basically, this determines the language of the report, and then prints the date on the statement in the required language.

However, I need to pass the Process date of the system to the report and not the system date. The process date is in text6.text on my form.

How do I pass the value in text6.text to FinancialSummary, so that it can be incorporated in the report ?


Passing Parameter To Crystal Report
I want to ask you How can I pass a parameter field to crystal report from Visual Basic 6 ????
I am using the Crystal Report Viewer .

Thank you very much!!!!

Passing Parameters To Crystal Report
How do I pass parameters to crystal report?

Passing Strings To Crystal Report
does anyone know how to pass a value from vb to crystal report? i created my report using a crystal report designer. so how do i pass values like date, current user, etc.. to crystal report? tnx in advance..

note: i didnt use the report as an add-in which would make it behave like a data report. i invoke the report using the crystal report activex control

Passing Parameters To Crystal Report From VB6
I'm trying to run a crystal report and generate a .csv file from VB6. I'm passing parameters to crystal report but it prompts me to type in the parameters. I don't want the users to type it in but rather pass it thru a variable. Here is a piece of my code:

eomCurrentStart = Year(Date) & "/09/01"
eomCurrentEnd = Year(Date) & "/09/01"

With CrystalReport1
.Connect = strconnLive
.ReportFileName = "M:ReportsEOMRenewals.rpt"
.Destination = crptToFile
.PrintFileType = crptCSV
.ParameterFields(0) = "@BeginDate;" & eomCurrentStart & ";True"
.ParameterFields(1) = "@EndDate;" & eomCurrentEnd & ";True"
.PrintFileName = strFilePath & "Test.csv"
.DiscardSavedData = 1
.Action = 1
End With

Any help would be appreciated.

Passing A Parameter To Crystal Report
Hello Everyone! I'm new to crystal reports and I want to make an inventory that could pass a parameter to a crystal report. Could you guys help me how to do it? I just need a few simple examples on how to start. Any help will be greatly appreciated. Thanks and god bless!

Passing Parameters From VB To Crystal Report
Hello, Im new to Crystal Report and VB and i have some questions regarding CR.
Just as bshaen noted earlier, we need to go through all the process in connecting the database once we open CR. Does it mean that we left CR as a blank report? I need to do a report where i have to pass all the user input from VB to crystal report viewer. How can i make sure that all the parameters that i passed is in the correct position?One more question : is there any other method besides dataset?

Any help is very much appreciated
Thanx in advance =)

Passing DateTimePicker To Crystal Report
Hi Guys,

I am new to and hope to get the guidance of experts here.

I have linked my mdb and extracted 2 tables.

The cr report prints out everything from the tables. I want to pass the date to the date parameter but to no avail.

I have search through the forum and perhaps I am too stupid to undertsand the solutions.

Thanks fro any kind soul who can help me. Thanks

Jonathan Chan (Spore)

Passing Strings To Crystal Report

I'm new here, i've read a lot of your solutions,codes and explanations. I was just wondering if how i can pass values to a text object in crystal report 8 or higher from a vb6 program...

If not on a text object then can i have a simplier code that would pass an i.e. "Hello World" to a crystal report object (those object that can accept values not the recordset fields since they already have their own values) using vb6...


Crystal Report - Passing Parameter

please tell me the syntax of SetReportVariableValue in crystal report. I am getting Run-time error '70' permission denied when I try this. any other way to pass parameter to the report? (I'm using CR 9 with VB 6)

Thanks in advance!


Passing Parameter To A Crystal Report
i'm using vb6 and crystal reports 8.5. i have a string value that i need to pass to my rpt. here is the sample of my code:

Set CRReport = New CRAXDRT.Report
Set CrxApp = CreateObject("CrystalRunTime.Application")
Set CRReport = CrxApp.OpenReport(vstrReportFile)
CRReport.Database.SetDataSource vPassedADORS, 3, 1
CRViewer1.ReportSource = CRReport
CRReport.ParameterFields(0) = " Par1;" + vstrParameters + " ;true"
CRReport.PrintOut False, 1, True

when i run this code i get the error subscript out of range.

when i create another project that uses the crystal report component i use the following code:

cry1.ParameterFields(0) = " Par1;" + vstrParameters + " ;true"

it works fine.

can any one help?

Thank You,

Passing Values To Crystal Report
how can i pass values from textbox to crystalreport using visualbasic codes?

Passing Two RecordSet To Crystal Report
How I Can Pass More Then Two ADO Record Set To Crystal Report 8. I Pass One RecordSet Bu Using The Following Code but I Can't Pass Two Record Set To Crystal Report.

VB Code:
Dim CrApp As New CRPEAuto.ApplicationDim CrRep As CRPEAuto.ReportDim CrDB As CRPEAuto.DatabaseDim CrTables As CRPEAuto.DatabaseTablesDim CrTable As CRPEAuto.DatabaseTableDim CrPars As New CRPEAuto.ParameterFieldDefinitionsDim CrPar As New CRPEAuto.ParameterFieldDefinition Dim Rec As New RecordsetDim Cn As New Connection  Cn.ConnectionString = Constr ' Having ConnectionStringCn.Open    Rec.Open "Select * From Sh", Cn, adOpenDynamic, adLockPessimistic Set CrRep = CrApp.OpenReport(App.Path & "TwoRec.rpt")Set CrDB = CrRep.DatabaseSet CrTables = CrDB.TablesSet CrTable = CrTables.Item(1)CrTable.SetPrivateData 3, RecCrRep.Preview

Passing Two Recordset To Crystal Report?!
I am using the following coding running well with one recordset. But when I edit it for two recordset its not working

VB Code:
Dim CrApp As New CRPEAuto.ApplicationDim CrR As CRPEAuto.ReportDim CrDB As CRPEAuto.DatabaseDim CrTables As CRPEAuto.DatabaseTablesDim CrTable As CRPEAuto.DatabaseTableDim Crtable2 As CRPEAuto.DatabaseTable 'Edit For Passing Two RecodSet Dim Rec As New RecordsetDim Cn As New Connection  Cn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=E:Vb DocumentCristal ReportDB.mdb;Persist Security Info=False"Cn.Open    Rec.Open TxtQury.Text, Cn, adOpenDynamic, adLockPessimistic  Set CrR = CrApp.OpenReport(App.Path & "TwoRec.rpt")Set CrDB = CrR.DatabaseSet CrTables = CrDB.TablesSet CrTable = CrTables.Item(1)Set Crtable2 = CrTables.Item(2) 'Edit For Passing Two RecodSet  Crtable2.SetPrivateData 3, RecCrTable.SetPrivateData 3, RecCrR.Preview

Passing Parameters To Crystal Report (RDC)
I am new to Crystal Reports. I earlier used Microsoft Data Report but it didnot have the 'Record Number' feature , so I have to re create my reports in Crystal Reports.I am using crystal report 8 designer control ( RDC) for my project on Payroll . I want to create a report which will generate the report based on the month & year.

I have a form containg two combo boxes from where the user will select the month & the year.

I want to pass this to Crystal Report Designer as a parameter.

I used the following query in data report.

select p.empno,e.fname, p.bsal,p.itax,p.netsal,p.mnth,p.yr from emp e, payroll p where e.empno=p.empno and p.mnth= ? and p.yr= ?
order by p.bsal

I used to pass the value for p.mnth & p.yr using the following code in a form which contained the text boxes.


option Explicit

Private Sub Command1_Click()
deConsolidated.Command1 cmbMonth.Text, cmbYear.Text
End Sub


Pls guide me how to pass the parameters from the above combo box to crystal report designer ( RDC)

Thanking you,

Passing Parameters To A Crystal Report
When using the RecordSlectionFormula
CReport.RecordSelectionFormula = "{Table1.Date} >= #" & DateFrom & "# And {Table1.Date} <= #" & DateTo & "#"
I want the DateFrom and the DateTo, that the user specified, to appear on the top of my Report. Does anyone know how to do this.

Using: CR Professional v8.5; MS Access 2000; VB 6.0

Parameter Passing In Crystal Report
I have designed a report in Crystal report 7.0 and wanted to view it thru VB6.0 application. I am using crystal report control. When I refresh my report from crystal report and enter a specific date the report generates for that date but when I refresh it from my VB application and enter any date its not giving anything. Do I need to set some property or something else. please help me. its very urgent.


Passing Param To Crystal Report
how can i pass a parameter to crystal report?

my report has to have a username whose value depends on the current user of my application, right now my report retrieve the value from a table i create to store the current user. but i dont want this, its kinda unprofessional, right? also since my app stores the name of the current user i think its best to just pass the value of the CURUSER, my var, to myreport than store it to a table and then let crystal report retrieve it.

OLE Object - Passing From VB To Crystal Report
I need to send a path to a *.bmp file to crystal report so that the report would bring whatever the picture is up on the report at run time. Every time the pictures are different. I talked to crystal report and they told me to try to insert an OLE object and pass the file from VB so that the OLE object is updated each time it is called. Do you know what they are talking about? How would I do that in VB? Thank you so much for your time.

Passing Parameters To Crystal Report From Vb6
I'm trying to run a crystal report and generate a .csv file from VB6. I'm passing parameters to crystal report but it prompts me to type in the parameters. I don't want the users to type it in but rather pass it thru variables. Here is a piece of my code:

eomCurrentStart = Year(Date) & "/09/01"
eomCurrentEnd = Year(Date) & "/09/01"

With CrystalReport1
.Connect = strconnLive
.ReportFileName = "M:ReportsEOMRenewals.rpt"
.Destination = crptToFile
.PrintFileType = crptCSV
.ParameterFields(0) = "@BeginDate;" & eomCurrentStart & ";True"
.ParameterFields(1) = "@EndDate;" & eomCurrentEnd & ";True"
.PrintFileName = strFilePath & "Test.csv"
.DiscardSavedData = 1
.Action = 1
End With

Any help would be appreciated.

Passing A Variable From VB To Crystal Sub Report

I have designed a report in CR 8.5 and this is having one sub report. Iwant to pass the no of months from VB to this report. Please let me knowhow I can pass this value.


Passing Variables To Crystal Report
any idea on how to pass the variables to the crystal report 10 without using direct access to the database.

pls help tnx

Passing Prompts To A Crystal Report
I've been struggling all day...can anyone HELP?

I can't seem to pass prompts from VB to a Crystal report.
All the examples I've seen say to create the applicaion like this:
Set CrystalApplication = CreateObject("Crystal.crpe.Application")

However, when I try to do that, I get an error. So, I created it like this:
Set CrystalApplication = CreateObject("CrystalRuntime.Application")

Does it matter?

Also, I cannot get the ".setCurrentValue" of the prompt ot show up on that becasue I haven't created the correction Application?

Which Crystal reference do I have to include in my VB app?

Thanks in advance,

Passing Parameter To Crystal Report
i'm using the CRViewer to view my report. i found out i cannot pass in Date into crystal report from VB. any one can give me help?

sample code:
CrxReport.ParameterFields(1).AddCurrentValue (format(now,"dd/mm/yyyy"))

the parameter in crystal report defined as Date.


Passing Parameters To Crystal Report 9
How to Pass the parameters to the Crystal Report 9 through VB 6 at runtime?

Passing String To Crystal Report

How can i pass a string from vb 6 to crystal report 8?

Thanks in advance!


RE: Passing Parameters To Crystal Report From VB6
I would apprechiate some help with this one.

created my report with CR10, fine....

but, how do i send parameters to it from my vb application?

any pointers would be great!


Edited by - Afy on 1/29/2005 1:29:03 PM





Passing Parameters From Vb .net To Crystal Report
I can't get out of this problem... I have seen all recent posts on this topic but it seems there is no way...

I built a report who show me some data i needs... I also created a textbox who allows me to search for some records in the reports...

After the search is completed, I'd like to view the parameter inserted in the textbox on the report but i still can't do that...

So, i tried to create a simple passing parameter code in the vb form but it seems that it's ignored by the program because when i open the report it shows me a windows which asks me for the value of parameter...

Here is the code:

        Dim crParameterFieldDefinitions As CrystalDecisions.CrystalReports.Engine.ParameterFieldDefinitions
        Dim crParameterFieldDefinition As CrystalDecisions.CrystalReports.Engine.ParameterFieldDefinition
        Dim crParameterValues As New CrystalDecisions.Shared.ParameterValues()
        Dim crParameterDiscreteValue As New CrystalDecisions.Shared.ParameterDiscreteValue()
        Dim crReport As New CrystalReport1()
        'Set Number Parameter
        'Set the discrete value
        crParameterDiscreteValue.Value = CInt(5)
        ' Access the first parameter field definition
        crParameterFieldDefinitions = crReport.DataDefinition.ParameterFields
        crParameterFieldDefinition = crParameterFieldDefinitions.Item("param")
        ' Add parameter value
        crParameterValues = crParameterFieldDefinition.CurrentValues
        ' Apply the current value to the parameter definition

It's obvious that i have also created a numeric parameter field in crystal report whose name is "param"...



Parameter Passing In Crystal Report
I am passing parameters to report ,but it is giveing me error "invalid Field ".
do each field have any specific index,or number in the report .I have designed the report already.

Passing Parameters To Crystal Report 9

This will be quick...i tried using both functions to pass parameters to my reports.

varCR = PESetNthParameterField(intJobHandle, i, TCrystalParam)


varCR = crPESetNthParameterField(intJobHandle, i, .ValueType, .DefaultValueSet, .CurrentValueSet, .Name, .Prompt, .DefaultValue, .CurrentValue)

They worked fine. But all of a sudden, the parameters aren't passed anymore therefore prompting me for the values of the parameters, which shouldn't happen. What's happening here??

I confirmed that it wasn't passed to the report by using 'PEGetNthParameterField'.

This is urgent guys so any kind of help is a big one. thanks!

Passing Crystal Report Formula By Using Vb
had anyone has got idea how to passthrough the formual fields in crystalreport by using vb forms..
what i mean is
I want to carry the some values (forumla) from cr1 to put in cr2 report to make calculations with some value fields in cr2 and calculate the accumulated fields by using vb...


Passing Parameter In VB6 To Crystal Report
Hi Babu,
I used code that you gave me but there is a error "205539 :Invalid parameter field name".Can you show me clearly? Thanks in advance!

Passing Parameter To Crystal Report
i am passing a string value from vb code to crystal report. in crystal report i have created this parameter as "Pyyyymm" receiving string value.

the vb code goes like this

report1.parameterfields(0) = "Pyyyymm;" & m_SelSalMnth & ";true"

where m_SelSalMnth contains '2002/10' or like value but it gives me error "can't find SQL Server" and error no. 20599.

i don't know where i am going wrong.

i am adding crystal report thru component and not thru reference i.e. i am using a crystal report control.

Waiting for a quick reply.


Passing A Header String From VB6 To Crystal Report
I am working with a VB6 form that is allowing the user to select parameters and run a report based on the parameters chosen. (i.e. date range). I am using crystal reports 7 to do the report, and I want to vary the Report header depending on what parameters are chosen by the user. How do I pass this into the Crystal report?

Passing Parameters To An Executable Crystal Report
I have a Crystal Report that is a stand-alone executable. The Report needs parameters passed to it, but I'm not sure how to do that when the report is an executable. I call the report through Shell, so can I pass the parameters on the command line?

'Like This?:
Shell App.Path & "MyReport.exe param1, param2", vbNormalFocus
Anyone have any ideas?

Problem Passing Parameter IN Crystal Report From Vb 6.0
WEll hi to all

I am new user here.........I really need help in my project

My problem is that i have made a project in Vb6.0 and database in Ms Access

Now i make report in Crystal report 9 and by using Wizard Expert

now what i want to do is i want to pass parameter by using my own design
form in Vb6.0 like i want to pass account no so it will display only the result of that account no i don't know that code exactly and please tell me do i need to use parameter option in crystal report or just pass parameter from Vb from

i will really thankful to those people who help me out in this regard

Sorry for poor english

Problem Passing Data To Crystal Report
Thanks for your snippet.

I now have a different problem. I am getting the error "INVALID TLV RECORD", how can i reslove this? Im using cyrstal 8.0.

No, I don't have crpaig32 but i do have crpaig80. any other suggestions.


Problem Passing Data To Crystal Report
i am now getting the error Invalid TLV record. I am using crystal 8.0

Can any one tell me what could be wrong.

I tried using the example that came with crystal report.
i used Ado as pass the recordset using the format Report.Database.SetDataSource rsCustomer, 3, 1
However this did not work or should i say it worked when
i use the debugger(F8), but when i ran the entire project, nothing is displayed.


Passing Variables To Crystal Report At Run Time
I'm running Crystal Report. I want to pass some variables to it at run time, like date between certain period. I mean I want Crystal Report to prompt me for the variable. How can I do this? I'm using version 8.5

Problems Passing Parameters To Crystal Report
I have visual basic 6.0 and I need an example how pass a parameter to crystal report. I need to know what I need colocate in visual basic and what I need to colocate in crystal report. I suppose that the important is that crystal doesn't ask the parameter because it will recieve the information of the visual basic.

Passing The Parameter To Crystal Report Using ParameterFieldDefinitions
Hi everyone,

I am get the error in assigning the value to the parameter of parameter1 in crystal reports. It is the string parameter type .I tried with setcurrentvalue and also addcurrentvalue mothod. But i can't able to pass the parameter.

Even though i am using
crRepp.EnableParameterPrompting = False
it prompting for the parameters values......

CrystalReport1 is ICRDesigner object

Dim Report As New CrystalReport1
Private Sub Form_Load()
Dim crApp As New CRAXDRT.Application
Dim crRepp As CRAXDRT.Report
Dim crParamDefs As CRAXDRT.ParameterFieldDefinitions
Dim crParamDef As CRAXDRT.ParameterFieldDefinition
Dim crDBTab As CRAXDRT.DatabaseTable

'Open report file
Set crRepp = crApp.OpenReport(App.Path & "ReportTest.rpt")
'Set location of database based on WhatCompany

crRepp.Database.LogOnServer "p2sodbc.dll", "Testpass", "Northwind", "sa", ""
'Set table location to appropriate company server

For Each crDBTab In crRepp.Database.Tables
crDBTab.SetLogOnInfo "Testpass", "Northwind", "sa", ""
crRepp.DisplayProgressDialog = False
crRepp.EnableParameterPrompting = False

'Fill report parameters
Set crParamDefs = crRepp.ParameterFields
For Each crParamDef In crParamDefs
Select Case crParamDef.ParameterFieldName
Case "Parameter1"
crParamDef.AddCurrentValue "eeeeee"
End Select


Screen.MousePointer = vbHourglass
CRViewer1.ReportSource = Report
Screen.MousePointer = vbDefault
End Sub

pls help me to come out the problem
Advance thanks


Passing Stored Procedure To Crystal Report In VB
Hello all

How do I pass a stored procedure to crystal report in VB correctly? I have a
stored procedure named "spTesitng" and I want to execute it and pass the
result to crystal report at run time. But I can't get it to work ...

Following is part of my code:

Set rptReport = Appl.NewReport
Set adoCommand = New ADODB.Command
Set adoCommand.ActiveConnection = adoConnection
adoCommand.CommandText = "[spTesting]"
adoCommand.CommandType = adCmdStoredProc

rptReport.Database.AddADOCommand adoConnection, adoCommand

Where do I need to make changes?

Thanks for all advise

KUEK Joe Sern

Problen In Crystal Report 8 On Parameter Passing
Dear Group Members

Need some help !

I have created a crystal report 8 name as Report1.rpt, I have alsoinserted a parameter field as NAM in this report, Than I have createda form in Vb6 and put a command button on this form and the code haswritten on this command event as

CrystalReport1.ReportFileName = "C:engg
CrystalReport1.ParameterFields(1) = "NAM;INDORAMA;TRUE"
CrystalReport1.Action = 1

The backend is oracle and have aslo setted the Odbc as Cror7 or Cror8

When I run this form and click on command button then a erroroccurs like

Run time error 20599
Can not open sql server

If I not use the parameter field NAM then this for is work properly

I am not getting that I am not using the Sql server then why it isdisplaying this error

I will be highly oblige if any one will send the solution at earliest


Dk Varshney

Passing Parameter To Crystal Report (SubReport)
  I have a report and subreport in crystal report. I am able to pass parameter to report but it doesn't work for subreport. I am not sure if there is any method available for this purpose. Any help would appreciate?

Here is my code to passing information to main report

CrxReport.ParameterFields.GetItemByName("SectionName").AddCurrentValue "Business - Solution"
I try to use the same mothod for passing DATE to subreport but I was not successful

Copyright 2005-08, All rights reserved