Hi Matt,
This is a lousy answer, but I ran into the same problem and developed a
workaround: when the date was merely for display (eg, date due) I pass a
string to a string parameter. However, when it is needed in a selection
formula, I pass a selection formula something like this:
Dim mglobals As New globals
mglobals.gl_selectionstring = "{bnlsum.invnum} >= '" & startnumbox.Text &
Chr(39) & " and {bnlsum.invnum} <= '" & endnumbox.Text & Chr(39)
gl_browseprintvar = "f:\imcapps\bnlinv.rpt"
Dim newmdichild As New reportprinter_viewerparam
newmdichild.Text = "BNL Summary Invoice"
newmdichild.ShowDialog()
CrystalReportViewer1.SelectionFormula = mglobals.gl_selectionstring
Note that I use the crystal syntax for {bnlsum.invnum} etc, so the report
acknowledges the selection formula.
This works fine for defining a date range filter. I've luckily not run into
a situation that could not be thus solved.
HTH,
Bernie Yaeger
"Matt MacDonald" <an*******@discussions.microsoft.com> wrote in message
news:EB**********************************@microsof t.com...
I'm trying to run a report using a form containing a crystal report
viewer, but I keep getting an error saying that "The specified value type is different to the current value type"
I'm trying to use date parameters. The parameter is set up as a date in
the report. Here's the code.
Dim paramfields As New CrystalDecisions.Shared.ParameterFields
Dim discreteval As New CrystalDecisions.Shared.ParameterDiscreteValue
Dim reporter As New bdb.frmReportViewer
Dim report As CrystalDecisions.CrystalReports.Engine.ReportDocum ent
report = Nothing
report = New DetForAcct
reporter.ReportFileName = report
Dim paramfield2 As New CrystalDecisions.Shared.ParameterField
paramfield2.ParameterValueKind =
CrystalDecisions.[Shared].ParameterValueKind.DateParameter paramfield2.ParameterFieldName = "EffectiveLow"
discreteval.Value = dtpStart.Value.Date
paramfield2.CurrentValues.Add(discreteval)
paramfields.Add(paramfield2)
reporter.ReportParameters = paramfields
reporter.MdiParent = Me.MdiParent
reporter.Show()
Any ideas?
Thanks, Matt