Print Page | Close Window

Pass parameters from vb6

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2020
Forum Name: Report Design
Forum Discription: The best way to design a report and problems you have encountered
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=1682
Printed Date: 04 May 2024 at 2:11am


Topic: Pass parameters from vb6
Posted By: zubairkhan
Subject: Pass parameters from vb6
Date Posted: 14 Nov 2007 at 12:59am
Hi,   I designed a report which is attached with stored procedure, it has two date parameters, when i run program it generates error "The specified value type is different to the current value type". The codes are as follows

strStartDate = Format(RTrim(str(Year(dtStart.Value))), "0000") + "/" + Format(RTrim(str(Month(dtStart.Value))), "00") + "/" + Format(RTrim(str(Day(dtStart.Value))), "00")
    strEndDate = Format(RTrim(str(Year(dtEnd.Value))), "0000") + "/" + Format(RTrim(str(Month(dtEnd.Value))), "00") + "/" + Format(RTrim(str(Day(dtEnd.Value))), "00")

    CRT.StoredProcParam(0) = "@firstdate = '" & strStartDate & "';true"
    CRT.StoredProcParam(1) = "@lastdate '" & strEndDate & " ';true"



Replies:
Posted By: jkwrpc
Date Posted: 14 Nov 2007 at 12:35pm
You may want to try converting your strings to dates when you pass them to the parameters (assuming the paramters are not typed as strings). For example
 
CRT.StoredProcParam(0) = "@firstdate = '" & CDate(strStartDate) & "';true"
    CRT.StoredProcParam(1) = "@lastdate '" & CDate(strEndDate) & " ';true"
 
It may resolve the issue since it the error message seems to reflect a data type problem.
 
Hope this helps
 
Regards,
 
John W.
http://www.CustomReportWriters.net - www.CustomReportWriters.net



Print Page | Close Window