Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Passing date parameter to parameter field in Crystal reports

Status
Not open for further replies.

san1975

Programmer
Feb 13, 2002
2
0
0
IN
I have created a parameterised stored procedure in which i will be passing a date and accordingly records will be fetched.In Crystal reports I choose this stored Procedure and I automatically get this date parameter as parameter fields as @dt.When I pass the date to this parameter through VB I get the error as "Invalid parameter field value." My code in VB is something like this:

sdt1 = Format(DTPicker1.Value, "yyyy,mm,dd")
CrystalReport1.ReportFileName = App.Path & "\reports\test.rpt"
CrystalReport1.ParameterFields(0) = "@dt; DATE(" & sdt1 & ");true"
CrystalReport1.action = 1

Can some one tell me what's the problem?
 
Data type of this parameter is set in sql stored procedure
as datetime.So in crystal reports I have no option to change it to date.It is disabled in crystal reports.
Any idea how can I change it?
 
Anybody have an answer for this one? I am haveing the same problem, but hate to post a new topic on the same subject.
 
Steve,

Post this one in the Crystal Reports - Integration forum, and you will get an answer. That is the forum for CR and VB integration.

I don't know VB or otherwise I would answer you. Software Training and Support for Macola, Crystal Reports and Goldmine
251-621-8972
dgilsdorf@mchsi.com
 
The main problem is the datetime to the stored proc. You can't change it. send it this way:

"@dt; DATETIME(" & sdt1 & ",0,0,0);true"

Lisa
 
Tried that and I get an "Invalid Parameter Field Value" Error.

 
try to use an index that's not 0, try an index of 1, and get rid of the @, so basically try something like:

CrystalReport1.ParameterFields(1) = "dt; DATE(" & sdt1 & ");true"

If you're still having problems with that, then add the @ back in. I'm not too familiar with stored procs, so you got me on that one, I just know that I ran into a similar problem and I just changed the index from 0 to 1, and it worked fine. I didn't use a ? for my parameter field name, so I don't think (key words "don't think") that you'd need one for a stored proc.

Let me know if that helps,

Jacob438
 
HELP!

i am using ms 2k and would like to perform a parameter query that will allow the user to display anywhere from one to a dozen or more records. thusfar i have the basics of parameter query, but am left wondering if i can somehow do a multi-parameter querry to feed a report.

thanks in advance

mikl67(wannabe dba)

[cheers]
 
OK Guys I think I have a solution which should work :

My setup is : PB (similar to VB)using OCX control.
Declare the following
StartYear$ = year(ad_letter_date)
StartMonth$ = Month(ad_letter_date)
StartDay$ = Day(ad_letter_date)

then pass it as follows :

ole_cr.object.ParameterFields[1] =
"letter_date;Date(" + string(StartYear$) + ", " + string(StartMonth$) + ", " + string(StartDay$) + ");TRUE"

All the best.
Bhattu
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top