Solved

Change a query on a crystal report at design or runtime

Posted on 2013-01-31
3
600 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Data Saving(2) 2 41
Needing an event fired when a row is added on a datagridview 4 36
Data is not showing from images 15 37
Reset asp.net login password 4 28
We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
This is a video describing the growing solar energy use in Utah. This is a topic that greatly interests me and so I decided to produce a video about it.
A company’s greatest vulnerability is their email. CEO fraud, ransomware and spear phishing attacks are the no1 threat to a company’s security. Cybercrime is responsible for the largest loss of money to companies today with losses projected to r…

911 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now