Crystal reports update parameter

Hi,

I have a crystalreportviewer on my form, I'd like to from a button on the form be able to update my report with a new parameter value once the report is already loaded, is there a way to change the parameter value in realtime through code, such as if I were to press the refresh button?

    
    Dim param1Fileds As New CrystalDecisions.Shared.ParameterFields
        Dim param1Field As New CrystalDecisions.Shared.ParameterField
        Dim param1Range As New CrystalDecisions.Shared.ParameterDiscreteValue

        param1Field.ParameterFieldName = "emp"
        param1Range.Value = "Phil" ' value For Parameter Field 
        param1Field.CurrentValues.Add(param1Range)
        param1Fileds.Add(param1Field)
        CrystalReportViewer1.ParameterFieldInfo = param1Fileds 'to pass parameter inf.to CRV
        CrystalReportViewer1.Refresh()

        Dim param1Fileds1 As New CrystalDecisions.Shared.ParameterFields
        Dim param1Field1 As New CrystalDecisions.Shared.ParameterField
        Dim param1Range1 As New CrystalDecisions.Shared.ParameterDiscreteValue

        param1Field1.ParameterFieldName = "emp"
        param1Range1.Value = "Carl" ' value For Parameter Field 
        param1Field1.CurrentValues.Add(param1Range1)
        param1Fileds1.Add(param1Field1)
        CrystalReportViewer1.ParameterFieldInfo = param1Fileds1 'to pass parameter inf.to CRV
        CrystalReportViewer1.Refresh()

Open in new window

FCapoAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

mlmccCommented:
You should be able to do that.  The button won't be part of the viewer.

What is wrong with the refresh button.

Your button should just rerun the code that loads the report and prompts for the parameters.

mlmcc
FCapoAuthor Commented:
I'd like to update the  parameter : param1Field1.ParameterFieldName = "emp"
to a different employee name by a button on the form, but it stays stuck on the first value i gave it "Phil"
mlmccCommented:
When you click the refresh button, you don't get the option to provide new values for the parameters?

If so there is an option on the viewer (I believe) to turn parameter prompting on/off.

mlmcc

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Crystal Reports

From novice to tech pro — start learning today.