?
Solved

Parameter field("From Date" & "To Date") in Crystal report

Posted on 2000-04-17
4
Medium Priority
?
222 Views
Last Modified: 2012-06-21
I would like to put parameter field in my report so that user can able to select date range("From Date" and "To Date") in report whenever he wants.

Thanks for your time in advance.

LEt me know as soon as possible.

Thanks,
bhavesh55
0
Comment
Question by:bhavesh55
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 6

Accepted Solution

by:
Marine earned 120 total points
ID: 2724664
Ok it should be something like this. You create 2 parameters using Command Object. You might have a statement already that looks like this.


cmd.commandtext="SELECT <fieldname>,<fieldname2> From <tablename> WHERE <fieldname> BETWEEN ? AND ?"
Then you create parameters.
cmd.CreateParameter ,adDateTime,adParamInput
cmd.CreateParameter ,adDateTime,adParamInput
cmd.Parameters(0) = text1.text
cmd.Parameters(1) = text1.text
cmd.Execute.

I didn't test it. I don't remember if that constant is correct for DateTime. If not replace it with the correct one. Post more if you get errors.

0
 
LVL 6

Expert Comment

by:Marine
ID: 2724672
um, btw you have to create connection before using command object i assumed that connection has been already defined. then cmd.activeconnection = <yourconnection>. this should be the line before you create parameters.
0
 
LVL 4

Expert Comment

by:gcs001
ID: 2725321
You can use the SelectionForumula or ReplaceSelectionFormula properties on the Crystal Report Control in VB.
If you've added the CR control to your VB project you can then pass the dates a user wants the report for as follows:

Report1.SelectionFormula("{table1.date} >= date(" & Format(Text1.Text,"yyyy,mm,dd") & ") and {table1.date} <= date(" & Format(Text2.Text,"yyyy,mm,dd") & ")")

Text1 and Text2 can be text boxes in your VB app that the user enters that start and end dates for the report.
{table1.date} is the table name and field name used in your Crystal Report.

Hope this helps.

Regards,
Grant.
0
 

Author Comment

by:bhavesh55
ID: 2745969
I am talking about crystal report only.

anyway, thanks for your help.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question