By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,885 Members | 1,191 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,885 IT Pros & Developers. It's quick & easy.

Crystal Report Parameters - Date

P: n/a
I'm trying to run a report using a form containing a crystal report viewer, but I keep getting an error saying tha
"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.ParameterField
Dim discreteval As New CrystalDecisions.Shared.ParameterDiscreteValu
Dim reporter As New bdb.frmReportViewe
Dim report As CrystalDecisions.CrystalReports.Engine.ReportDocum en
report = Nothin
report = New DetForAcc
reporter.ReportFileName = repor

Dim paramfield2 As New CrystalDecisions.Shared.ParameterFiel
paramfield2.ParameterValueKind = CrystalDecisions.[Shared].ParameterValueKind.DateParamete
paramfield2.ParameterFieldName = "EffectiveLow
discreteval.Value = dtpStart.Value.Dat
paramfield2.CurrentValues.Add(discreteval
paramfields.Add(paramfield2

reporter.ReportParameters = paramfield
reporter.MdiParent = Me.MdiParen
reporter.Show(

Any ideas
Thanks, Matt
Nov 20 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
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

Nov 20 '05 #2

P: n/a
Any idea how to go about it if I'm starting with a date data type from a
date time picker?

"Bernie Yaeger" <be*****@cherwellinc.com> wrote in message
news:OS*************@TK2MSFTNGP10.phx.gbl...
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


Nov 20 '05 #3

P: n/a
Hi Matt,

Sure:

Dim d As String

d = DateTimePicker1.Value.ToShortDateString

MessageBox.Show(d)

d is now a string displaying, eg, 4/28/04. It's easy from here.

HTH,

Bernie

"Matt MacDonald" <ma******@hotmail.com> wrote in message
news:Ou**************@TK2MSFTNGP12.phx.gbl...
Any idea how to go about it if I'm starting with a date data type from a
date time picker?

"Bernie Yaeger" <be*****@cherwellinc.com> wrote in message
news:OS*************@TK2MSFTNGP10.phx.gbl...
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



Nov 20 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.