kenspencer
asked on
Changing Crystal Report ParameterField in VB
Hi,
I have a Crystal Report which uses a stored procedure for its data source. The stored
procedure has a parameter, TARGETDATE, which I am obtaining from the user and
trying to pass to Crystal.
I open a Crystal Report and set some values:
With crwRpt
.FormulaFields(1).Text = "'" & sDate1 & "'"
.RecordSelectionFormula = sSel2
.ParameterFields(0) = sSel1
End With
The sSel1 variable is: TARGETDATE;2002-03-15;TRUE
Even though this is the format stated in another EE question, I get the infamous 'Type mismatch'
error on the ParameterFields statement. I am using VB6 and Crystal 8.
Any ideas?
Ken
I have a Crystal Report which uses a stored procedure for its data source. The stored
procedure has a parameter, TARGETDATE, which I am obtaining from the user and
trying to pass to Crystal.
I open a Crystal Report and set some values:
With crwRpt
.FormulaFields(1).Text = "'" & sDate1 & "'"
.RecordSelectionFormula = sSel2
.ParameterFields(0) = sSel1
End With
The sSel1 variable is: TARGETDATE;2002-03-15;TRUE
Even though this is the format stated in another EE question, I get the infamous 'Type mismatch'
error on the ParameterFields statement. I am using VB6 and Crystal 8.
Any ideas?
Ken
The date passed must be a real date type.
Try
sSel1 = "TARGETDATE;" & date(2002,03,15) & ";TRUE"
good luck
mlmcc
Try
sSel1 = "TARGETDATE;" & date(2002,03,15) & ";TRUE"
good luck
mlmcc
Forget to mention -- TARGETDATE is a string.
Missed that part. The value must be a string
Try
sSel1 = "TARGETDATE;'2002-03-15';T RUE"
good luck
mlmcc
Missed that part. The value must be a string
Try
sSel1 = "TARGETDATE;'2002-03-15';T
good luck
mlmcc
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
mimcc:
Tried enclosing date with single quotes -- still got type mismatch error.
bill02:
I had seen this example in one of the Crystal manuals, but was hoping that a
simple assignment statement would work without going the 'long' way. However,
I will try it.
Ken
Tried enclosing date with single quotes -- still got type mismatch error.
bill02:
I had seen this example in one of the Crystal manuals, but was hoping that a
simple assignment statement would work without going the 'long' way. However,
I will try it.
Ken
ASKER
Going the long route seems to have had some effect, since I do not get the 'Type Mismatch' error. The parameter field name (in Crystal) was {?TARGETDATE}. However, it appears that the report starts to run before I get:
Run-time error '20534':
Error detected by database DLL.
I could not find this error code in the DB2 reference, so I am still needing assistance.
I will post another question in the DB2 forum for that, but will hold this one open for any other suggestions.
It was supposed to be a simple report ...
Ken
Run-time error '20534':
Error detected by database DLL.
I could not find this error code in the DB2 reference, so I am still needing assistance.
I will post another question in the DB2 forum for that, but will hold this one open for any other suggestions.
It was supposed to be a simple report ...
Ken
ASKER
Well, success at last. Going the long route (mentioned above), I had to use:
.SetCurrent Value <just the date string> 'example: 2002-03-18
Thanks for the suggestions. Since the short method did not work and the long method did, I will award points to bill02. However, since I had seen that methodology in the Crystal Reports Developer's Guide prior to even asking this question, and that the string value required was just the date portion of sSel1, I will award a lower grade.
Thanks for everyone's suggestions.
Ken
.SetCurrent Value <just the date string> 'example: 2002-03-18
Thanks for the suggestions. Since the short method did not work and the long method did, I will award points to bill02. However, since I had seen that methodology in the Crystal Reports Developer's Guide prior to even asking this question, and that the string value required was just the date portion of sSel1, I will award a lower grade.
Thanks for everyone's suggestions.
Ken
If you found the answer before asking you shouldn't have asked a answer that answers your question and does what you ask should recieve a higher than a c grade im taken back by that anyways thanks for the points
ASKER