Solved

Change a query on a crystal report at design or runtime

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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Article by: Najam
Having new technologies does not mean they will completely replace old components.  Recently I had to create WCF that will be called by VB6 component.  Here I will describe what steps one should follow while doing so, please feel free to post any qu…
Hello everyone, Hope you find this as helpful as we did. We have on the company I work for an application built in Delphi V with Crystal Reports 8. We all know that Crystal & Delphi can be temperamental sometimes and the worst thing is, nearly…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

708 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

16 Experts available now in Live!

Get 1:1 Help Now