Solved

Change a query on a crystal report at design or runtime

Posted on 2013-01-31
3
603 Views
Last Modified: 2013-01-31
Hi

Is it possible to change a crystal reports query at design or runtime?

for example, I have a single report which can be used for a multitude of reports, with just the change of on parameter.  Like, employee birthdays, if I want to get all employees who have a DOB in january, the query is the same for every other month aside from the date...

I am using MS Access as the datasource in a c#2010 winforms application

I tried using [month] in the query as a parameter, but that accepts a numeric value.. which is ok, but I would prefer for the user to have a dropdown list of months with January, February and so on... and for the query to feed from that... can this be done?

Cheers

CD
0
Comment
Question by:cycledude
  • 2
3 Comments
 
LVL 77

Accepted Solution

by:
peter57r earned 500 total points
ID: 38839037
I'm assuming you mean you are using the Add Command feature to base the report on a sql command. (If not you will have to explain what you mean by 'change the crystal reports query')

In the dialog where you create the sql Command you have an option to create a parameter.

Say you create a new parameter of type string called MyMonth and set it to default to January.
 You can then then incorporate the parameter into the sql command....

like...

Select * from Orders where Format([Order Date], "mmmm")='{?myMonth}'

In addition having created the parameter this way,  you can then go into the parameter fields in the main Crystal Field Explorer and modify the parameter - add a list of month names as the possible values.
0
 

Author Comment

by:cycledude
ID: 38839228
hey peter, thanks for the input


You just saved me a load of hassles!

Cheers
0
 

Author Closing Comment

by:cycledude
ID: 38839232
thanks dude
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

806 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