473,396 Members | 1,858 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Crystal Report Parameters - Date

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
3 3244
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Stephan | last post by:
Hi, I'm using Visual Studio 2003 (C#) with the integrated Crystal Report software and have the following question: How can I assign a value (string) to an unbound (string) field in Crystal...
6
by: Robin Cushman | last post by:
Hi all, I need some help -- I'm working with an A2K database, using DAO, and am trying to read records into a Crystal Report and then export it to a folder on our network as an Excel...
3
by: Vivek | last post by:
Hi All, I am using .Net studio C sharp windows application (WinForm). Crystal reports r running fine.. I want to diplay report with conditions... Want to pass parameters to CR.. e.g. Start Date...
0
by: Henry | last post by:
Using ideas provided by some of you I was able to figure out how to get the names of the parameters fields of a crystal report specified at run time. The code below just basically puts the...
0
by: lewindha | last post by:
Hi all I am new to ASP.Net and Crystal Reports. We have VS.Net 2003 and Crystal 10 where I work. I have successfully been able to view reports in a web page. My problem now is that I have a...
0
by: Vadim Vulfov | last post by:
My task was to create Crystal Report on ASP.NET page to display different date depending on to textboxes From Date and To Date. I created stored procedure in SQL with two parameters from_date and...
12
by: Bill Nguyen | last post by:
What's the VB syntax to run the CR report using the following SP? I use CrystalreportViewer and ReportDocument. Thanks Bill Here's the SP in SQLserver 2K: CREATE proc mysp_ReportSubmission...
0
by: Chris | last post by:
I have the following situation in a VB.Net App I am working on: 1.)A report created in VS.Net 2003 using the CR.Net component of VS 2003. 2.)The datasource for the report is a Stored Proc in a...
1
by: steveberwick | last post by:
**Using Visual Studio 2005 and Crystal Reports XI Release 2 Developer Edition. I currently have a multi-threaded C# application that loads a Crystal Report at runtime, fills out the necessary...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.