update parameter changes as soon as another parameter

  • I have a parameter in vai get today's date and have another parameter that will get the date one year ago. So far so good. But I would like to click on the calendar for today's date and moved to a date yesterday for example another parameter also would change automatically?

    Parameter today = CDate (Format (DateAdd ("d", -1, now ()), "MM / dd / yyyy 1:00"))

    parameter year ago = CDate (Format (DateAdd ("d", -365, now ()), "MM / dd / yyyy 1:00"))

  • I am going to have to assume that the second parameter is hidden, otherwise this would appear to be near impossible (or extremely complicated), since whatever logic you use will be based on the value in the 1st parameter.

    For the 2nd parm, set your default value based on the other parm's value, like so:

    =DateAdd(DateInterval.Day,-365,Parameters!StartDate.Value)

    That's it. The other way this could be accomplished would be to use a global variable (the value of the 1st parm again), but this method for the scenario you described is much easier.

  • yes the other field is to stay hidden.

    I put the following code = CDate (Format (DateAdd ("d", -364, Parameters! DataA.Value) "MM / dd / yyyy 1:00"))

    But when I change the parameter DataA the above code does not change anything. gives the feeling that no updates

  • You do need to refresh the report after changing a parameter. To prove whether it is working or not, temporarily display the parameter fields in the body of the report until it works as desired. Good luck.

  • But is there any command to refresh the Paramenters. Or is just to say f5 (refresh)?

  • amadeu_j, I appologize, but I just tried this and this creates a "forward depenency" error message (I thought that I have done this in the past, again, sorry for misleading you).

    The best solution is to alter your SQL, basically the same way you attempted to adjust the 2nd parameter. Something like:

    WHERE columName BETWEEN @Parm1Date and DATE_ADD(year, -1, @Parm1Date)

    since all your really need is to work off of one date.

Viewing 6 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply