473,804 Members | 2,028 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 CrystalDecision s.Shared.Parame terField
Dim discreteval As New CrystalDecision s.Shared.Parame terDiscreteValu
Dim reporter As New bdb.frmReportVi ewe
Dim report As CrystalDecision s.CrystalReport s.Engine.Report Documen
report = Nothin
report = New DetForAcc
reporter.Report FileName = repor

Dim paramfield2 As New CrystalDecision s.Shared.Parame terFiel
paramfield2.Par ameterValueKind = CrystalDecision s.[Shared].ParameterValue Kind.DateParame te
paramfield2.Par ameterFieldName = "EffectiveL ow
discreteval.Val ue = dtpStart.Value. Dat
paramfield2.Cur rentValues.Add( discreteval
paramfields.Add (paramfield2

reporter.Report Parameters = paramfield
reporter.MdiPar ent = Me.MdiParen
reporter.Show(

Any ideas
Thanks, Matt
Nov 20 '05 #1
3 3272
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_sel ectionstring = "{bnlsum.invnum } >= '" & startnumbox.Tex t &
Chr(39) & " and {bnlsum.invnum} <= '" & endnumbox.Text & Chr(39)

gl_browseprintv ar = "f:\imcapps\bnl inv.rpt"

Dim newmdichild As New reportprinter_v iewerparam

newmdichild.Tex t = "BNL Summary Invoice"

newmdichild.Sho wDialog()

CrystalReportVi ewer1.Selection Formula = mglobals.gl_sel ectionstring

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*******@disc ussions.microso ft.com> wrote in message
news:EB******** *************** ***********@mic rosoft.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 CrystalDecision s.Shared.Parame terFields
Dim discreteval As New CrystalDecision s.Shared.Parame terDiscreteValu e
Dim reporter As New bdb.frmReportVi ewer
Dim report As CrystalDecision s.CrystalReport s.Engine.Report Document
report = Nothing
report = New DetForAcct
reporter.Report FileName = report

Dim paramfield2 As New CrystalDecision s.Shared.Parame terField
paramfield2.Par ameterValueKind = CrystalDecision s.[Shared].ParameterValue Kind.DateParame ter paramfield2.Par ameterFieldName = "EffectiveL ow"
discreteval.Val ue = dtpStart.Value. Date
paramfield2.Cur rentValues.Add( discreteval)
paramfields.Add (paramfield2)

reporter.Report Parameters = paramfields
reporter.MdiPar ent = 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*****@cherwe llinc.com> wrote in message
news:OS******** *****@TK2MSFTNG P10.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_sel ectionstring = "{bnlsum.invnum } >= '" & startnumbox.Tex t &
Chr(39) & " and {bnlsum.invnum} <= '" & endnumbox.Text & Chr(39)

gl_browseprintv ar = "f:\imcapps\bnl inv.rpt"

Dim newmdichild As New reportprinter_v iewerparam

newmdichild.Tex t = "BNL Summary Invoice"

newmdichild.Sho wDialog()

CrystalReportVi ewer1.Selection Formula = mglobals.gl_sel ectionstring

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*******@disc ussions.microso ft.com> wrote in message
news:EB******** *************** ***********@mic rosoft.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 CrystalDecision s.Shared.Parame terFields
Dim discreteval As New CrystalDecision s.Shared.Parame terDiscreteValu e
Dim reporter As New bdb.frmReportVi ewer
Dim report As CrystalDecision s.CrystalReport s.Engine.Report Document
report = Nothing
report = New DetForAcct
reporter.Report FileName = report

Dim paramfield2 As New CrystalDecision s.Shared.Parame terField
paramfield2.Par ameterValueKind =

CrystalDecision s.[Shared].ParameterValue Kind.DateParame ter
paramfield2.Par ameterFieldName = "EffectiveL ow"
discreteval.Val ue = dtpStart.Value. Date
paramfield2.Cur rentValues.Add( discreteval)
paramfields.Add (paramfield2)

reporter.Report Parameters = paramfields
reporter.MdiPar ent = Me.MdiParent
reporter.Show()

Any ideas?
Thanks, Matt


Nov 20 '05 #3
Hi Matt,

Sure:

Dim d As String

d = DateTimePicker1 .Value.ToShortD ateString

MessageBox.Show (d)

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

HTH,

Bernie

"Matt MacDonald" <ma******@hotma il.com> wrote in message
news:Ou******** ******@TK2MSFTN GP12.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*****@cherwe llinc.com> wrote in message
news:OS******** *****@TK2MSFTNG P10.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_sel ectionstring = "{bnlsum.invnum } >= '" & startnumbox.Tex t & Chr(39) & " and {bnlsum.invnum} <= '" & endnumbox.Text & Chr(39)

gl_browseprintv ar = "f:\imcapps\bnl inv.rpt"

Dim newmdichild As New reportprinter_v iewerparam

newmdichild.Tex t = "BNL Summary Invoice"

newmdichild.Sho wDialog()

CrystalReportVi ewer1.Selection Formula = mglobals.gl_sel ectionstring

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*******@disc ussions.microso ft.com> wrote in message
news:EB******** *************** ***********@mic rosoft.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 CrystalDecision s.Shared.Parame terFields
Dim discreteval As New CrystalDecision s.Shared.Parame terDiscreteValu e
Dim reporter As New bdb.frmReportVi ewer
Dim report As CrystalDecision s.CrystalReport s.Engine.Report Document
report = Nothing
report = New DetForAcct
reporter.Report FileName = report

Dim paramfield2 As New CrystalDecision s.Shared.Parame terField
paramfield2.Par ameterValueKind =

CrystalDecision s.[Shared].ParameterValue Kind.DateParame ter
paramfield2.Par ameterFieldName = "EffectiveL ow"
discreteval.Val ue = dtpStart.Value. Date
paramfield2.Cur rentValues.Add( discreteval)
paramfields.Add (paramfield2)

reporter.Report Parameters = paramfields
reporter.MdiPar ent = 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
19189
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 Report at runtime? Example: private void button1_Click(object sender,
6
13145
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 spreadsheet. I'm having trouble with my code at the point at which it hits ".ReadRecords" -- the module just runs and runs without generating anything. I've gotten this code to correctly save .rpt files without any data, but not with data, nor have I been...
3
2617
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 and End Date??? Thanx In Advance Vivek Kumbhojkar
0
2077
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 data into a comboBox. One thing I noticed, however, is that this method shows me both the parameters used by the main report and parameters used by the sub-report(s).
0
1533
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 report that takes two parameters. A clientID parameter(number) and a date parameter(Date type). I set a form that gets the possible values from the DB and places them into drop down lists. When I select the params and click the button, I
0
1292
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 to_date. I created dataset object in ASP.NET (drag and drop on it the stored procedure I just created) and save as XSD file. In the Crystal Report selected all the fields and included into the
12
10417
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 @salesdate as varchar(20),
0
2276
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 SQL Server DB (pull method). 3.)The Stored Proc has two input parameters of type date. 4.)The Stored Proc is a rather complex proc that was not written by me, but does work(see next item). It currently returns about 13K rows of data. 5.)The...
1
3295
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 parameters and then exports the file to disk. I export around 5000 reports a day, in about 3 hours (nightly runs of the day's transactions), but sometimes, without warning or any debug info, the application locks-up using 100% of the processor...
0
9711
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10595
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10335
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10088
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9169
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7633
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
1
4306
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3831
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3001
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.