0

I Have a report using report viewer/vba and I am trying to pass a parameter to it using the code:

    Dim parameters(0) As ReportParameter
    parameters(0) = New ReportParameter("Model", "XBR-32")
    Me.ReportViewer1.LocalReport.SetParameters(parameters)

and when I execute the webform it goes like this for more than 10 minutes an the report does not open:

enter image description here

I don't know if I am passing the parameters in the wrong way. can someone help me, please?

  • I don't believe this is the issue. Is it a really big query? Can you post the section where you open the report also? What happens when you open it without the parameter? [This may help also](https://stackoverflow.com/questions/42511730/c-sharp-reportviewer-local-report-with-parameter) – Jimmy Smith Jun 04 '20 at 14:18
  • Hi. No it is not a big query. When I delete the parameter and open the report, it works fine! follow the section: Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Dim parameters(0) As ReportParameter parameters(0) = New ReportParameter("Model", "XBR-32") ReportViewer1.LocalReport.SetParameters(parameters) End Sub – Tais Nayara Jun 04 '20 at 14:32
  • First things first, work out what language you're using. Get rid of the language from the title - that's what tags are for - and change the language tag if this is really VBA rather than VB.NET. As the tag descriptions state, they are different languages and you don't use each for the other. – jmcilhinney Jun 04 '20 at 15:34
  • @jmcilhinney I think based on the code content that it's VB.NET not VBA. The sub call has parens around the parameters, in VBA it would not. – Craig Jun 04 '20 at 18:07
  • Hey guys, sorry for that but it is VB.NET and I don't know for sure what happened but if I pass the parameters on a button to call the report it works, but on the method Load it does not. anyway, I create a button to call instead of load the report when I open the page. Thanks! – Tais Nayara Jun 05 '20 at 12:05

1 Answers1

0

Maybe you need to remember to put parameters after you pick the path to the Report never before.

See the similar question:VB.Net Report viewer parameters

Julie Xu-MSFT
  • 334
  • 1
  • 5