Sunday, February 12, 2012

Beginner - Help needed in parameter passing

Hello,
I want to pass the parameter from VB6 to crystal report to get the reports. I want to pass the string and date parameters. I tried. But, I am getting errors. Pl. help and give the syntax for passing (both the types of parameters).To pass a string

Cr.Parameter(0)='" & string & "'

To pass a Date

Cr.Parameter(0)=#" & date & "#|||When passing parameters like the one you give, it shows syntax error (expecting expression) during the run time. Is anything has to be done in CR?|||Which version of CR you are using?|||CR version 8.5. VB 6 - Actually there is no "parameter" property. I selected parameter field property. It shows the syntax error. When parameter alone is given it shows "missing expression" error. Pl. help .
Meenakshi.R|||Pl. help me in parameter passing. I used the following code

crystalreport1.selectionformula="{servmst.mrtcd}=' "&wmrtcd&" ' "

by following a book I referred. wmrtcd is the variable I assigned to get the value at run time. But the code shows the error message 'Syntax error'. Pl. help me in completion of my project|||What is the datatype of mrtcd?
If it is numeric, then
crystalreport1.selectionformula="{servmst.mrtcd}= "&val(wmrtcd)&""|||wmrtcd is a string value. I typed like this
CrystalReport1.SelectionFormula = "{servmst.mrtcd}= "&wmrtcd&""
It shows syntax error.|||Anybody Pl. help me in parameter passing.|||How about using Selection formula from the menu?
Open the report goto Report->Selection Formulas->Record
then write this code
{servmst.mrtcd}= parametername|||Sir,
I wrote the code as you given. But whenever I select the parameter from the VB code it displays the first record only. What to do? But I am selecting some other record. Here I have listed the code I used. Pl. guide me

Private Sub Cmd_run_Click()
MsgBox wmrtcd
CrystalReport1.ReportFileName = "f:\meena\project\test\sermrtcd.rpt"
CrystalReport1.Action = 1

With the message box, I can get the parameter I selected.|||Hi!

plz try this format

String :
---

wmrtcd="{emp_det.emp_id} = '"& trim(your_id) &"'"

CrystalReport1.ReportFileName = "f:\meena\project\test\sermrtcd.rpt"
CrystalReport1.SelectionFormula = wmrtcd
CrystalReport1.Action = 2

Numeric :
----

wmrtcd="{emp_det.emp_id} = "& trim(your_id) &""

CrystalReport1.ReportFileName = "f:\meena\project\test\sermrtcd.rpt"
CrystalReport1.SelectionFormula = wmrtcd
CrystalReport1.Action = 2

Date :
---

Dim da, str As Variant
Dim a, b, c, e As Variant

da=cdate(rsEmp.fields("emp_det.emp_doj").value)

a = Day(da.Value)
b = Month(da.Value)
c = Year(da.Value)

d = "#" & c & "/" & b & "/" & a & "#"

wmrtcd="{emp_det.emp_doj} = '"& d &"'"

CrystalReport1.ReportFileName = "f:\meena\project\test\sermrtcd.rpt"
CrystalReport1.SelectionFormula = wmrtcd
CrystalReport1.Action = 2

note : crystal report date format is "YYYY/MM/DD"|||Hi,
I can't understand what is "your_id". But I tried this code
MsgBox wmrtcd
wmrtcd = "{servmst.mrtcd} = '" & Trim(wmrtcd) & "'"
CrystalReport1.ReportFileName = "f:\meena\project\test\sermrtcd.rpt"
CrystalReport1.SelectionFormula = wmrtcd

CrystalReport1.Action = 1

It shows the following error.
Run Time error '20515'
Error in file f:\meena\project\test\sermst.rpt
Error in formula <Record_Selection>
' The remaining text does not appear to be part of the formula.

What to do? Pl. help me.|||Make sure you have given the correct column name|||Hi!

Its a Parameter Value.

EmpID='ii-0406'
EmpSal=6000
EmpDoj="13/09/2004"

String :
---

wmrtcd="{emp_det.emp_id} = '"& trim(EmpID) &"'"

CrystalReport1.ReportFileName = "f:\meena\project\test\sermrtcd.rpt"
CrystalReport1.SelectionFormula = wmrtcd
CrystalReport1.Action = 2

Numeric :
----

wmrtcd="{emp_det.emp_id} = "& trim(EmpSal) &""

CrystalReport1.ReportFileName = "f:\meena\project\test\sermrtcd.rpt"
CrystalReport1.SelectionFormula = wmrtcd
CrystalReport1.Action = 2

Date :
---

Dim da, str As Variant
Dim a, b, c, e As Variant

da=cdate(EmpDoj)

a = Day(da.Value)
b = Month(da.Value)
c = Year(da.Value)

d = "#" & c & "/" & b & "/" & a & "#"

wmrtcd="{emp_det.emp_doj} = '"& d &"'"

CrystalReport1.ReportFileName = "f:\meena\project\test\sermrtcd.rpt"
CrystalReport1.SelectionFormula = wmrtcd
CrystalReport1.Action = 2|||Hai,
I tried with the following code.
MsgBox wmrtcd
wsel = "{servmst.mrtcd} = '" & Trim(wmrtcd) & "'"
MsgBox wsel
CrystalReport1.ReportFileName = "f:\meena\project\test\sermrtcd.rpt"
CrystalReport1.SelectionFormula = wsel

But still gets the same error. With the mesg box it shows
servmst.mrtcd='A001'

When debugging the error, it shows
wsel = "{servmst.mrtcd}='A001'" (when mouse is dragged over the line.

Pl. help me from coming out of this problem.

Regards|||Hi! see this link

http://support.businessobjects.com/library/kbase/articles/c2010935.asp

else

plz try to add the report as dsr.

1) Visual Basic -->Project Explorere-->Add-->More ActiveXdesigner-->Crystal Reports8.5

then customize ur report as u like.

i am attaching a sample report here plz see this.

regards
muthu|||Hai,
I have included that crystal report using designer. But how to name the object "Crystal viewer". In the sample code it is written as crviewer1. I have tried with crystalviewer, crviewer. But whatever I type it shows " No object". Pl. help.

Regards|||Help me in completion of the project|||You need to use Crystal Viewer and use that name in the code|||Hi! see this link

http://support.businessobjects.com/library/kbase/articles/c2010935.asp

else

plz try to add the report as dsr.

1) Visual Basic -->Project Explorere-->Add-->More ActiveXdesigner-->Crystal Reports8.5

then customize ur report as u like.

i am attaching a sample report here plz see this.

regards
muthu

No comments:

Post a Comment