Solved

Change a query on a crystal report at design or runtime

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

Industry Leaders: 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

There have always been a lot of questions related to when Crystal Reports evaluates report components (such as formulas, summaries, cross-tabs, charts, to name a few examples). Crystal Reports uses a two-pass reporting process to provide greater …
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
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

740 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