473,472 Members | 2,181 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

How to pass a date parameter in Crystal reports

41 New Member
Hi,

I am using a dataset for my Crystal report. Query: Select * from Orders where Date = @Date

How do I pass that to my Crystal Report. This will be passed with a calander I have on my form with a button to display data.

Thanks for the help.
Apr 2 '07 #1
4 10425
dip_developer
648 Recognized Expert Contributor
Hi,

I am using a dataset for my Crystal report. Query: Select * from Orders where Date = @Date

How do I pass that to my Crystal Report. This will be passed with a calander I have on my form with a button to display data.

Thanks for the help.
Do u want to Pass Date value as a parameter to the Crystal report.....

Create a Parameter Fields in your report .Name it as Order_Date,set its Value Type to Date.......By right Clicking on "Parameter Fields"-----> "New" option.....

In code behind to set the parameter value the code will be like following.....


Expand|Select|Wrap|Line Numbers
  1. Dim oRpt as Myreport
  2. oRpt.SetParameterValue("Order_Date", myDate)
Apr 2 '07 #2
Lawrence 007
41 New Member
Thanks dip_developer

I had to get some sleep. Will be trying that now and will let you know what happens.

Lawrence
Apr 2 '07 #3
Lawrence 007
41 New Member
dip_developer,

It still runs the report and display's all the data. Not just the data for the day I need.

Any Ideas?
Apr 2 '07 #4
Lawrence 007
41 New Member
To all that wants to know, here is the answer.

After a lot of searching this is what I did to make it work:


rpt = New CrystalReport1()
Dim reportPath As String = "C:\Crystalreport1.rpt"
CView.ReportSource = rpt
Dim field1 As ParameterField = Me.CView.ParameterFieldInfo(0)
Dim val1 As ParameterDiscreteValue = New ParameterDiscreteValue
val1.Value = "2/20/2007"
field1.CurrentValues.Add(val1)
rpt.Load(reportPath)

It is VERY important to place the parameter After :

CView.ReportSource = rpt
And before:
rpt.Load(reportPath)

It will not work if you don't do this.

Lawrence
Apr 3 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Wayne Baswell | last post by:
I want to pass a date variable to a sql statement from Crystal Reports. The part of the query accepting the variables looks like: "Calendar_Date between To_Date('1-JUN-03','mm/dd/yy') and...
0
by: Raj | last post by:
hi, How to pass a Two Date parameter to a report at runtime using VB .NET 1. How do we pass multiple values eg. Startdate, EndDate to crystal reports parameter. 2. I have a report to...
0
by: John Smith | last post by:
I'm passing two date parameters into a crystal report but it won't let me input anythign other than mm/dd/yy. What I want to put in is dd/mm/yy. Here is my code: Dim cr As New cleaningHistory ...
4
by: MeNotHome | last post by:
I have a couple of variables in vb.net that I want to have printed on my crystal reports report. How can I do this? Thanks for any info
4
by: Marcelo | last post by:
Any suggestion? Thanks Marcelo
5
by: rammy | last post by:
I have a stored procedure that gets the date as input parameter. I have connected this stored proc to crystal report. When i run the report, for the date parameter, the crystal report is asking to...
1
by: sreedivya | last post by:
Hi All I am trying to create crystal reports. In this concern i have created a command which execute a stored procedure. This stored procedure takes three parameters which in turn i want to pass it...
1
by: kizmar | last post by:
I'm having an issue with a stored procedure I'm working on. One of the parameters is a DATE field. I'm attaching to this stored procedure with Crystal Reports, which is passing something like...
0
by: jans78 | last post by:
Appreciate if you all can help me to solve my Crystal Report problems First, I create some parameters and one of the parameters is Date. I set the parameter for the date is String. For example :...
0
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,...
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
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,...
0
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...
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,...
1
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...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
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 ...

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.