SubReport problem

Posted by: jrebocho on 16 September 2017, 7:55 am EST

  • Posted 16 September 2017, 7:55 am EST

    I have an ASP web page that I'm calling a report with 2 subreports. When I add the tag "vsr.Fields("SubRouting").Subreport=vsrSub" it gives an error page. I have this working in another report without any issues. Can anyone give me some help?

    Thanx in advance,

    John

  • Posted 16 September 2017, 7:55 am EST

    When it hits that line of code it gives me a general IIS " Page can not be displayed" error.

    What other detail would do you need?

  • Posted 16 September 2017, 7:55 am EST

    When it hits that line of code it gives me a general IIS " Page can not be



    displayed" error.



    What other detail would do you need?







    vsr.Fields(“SubRouting”).Subreport=vsrSub







    In this case, it seems like the obvious 'candidates' for errors would be:





    1. 'vsr' doesn't exist

    2. “SubRouting” field doesn't exist in vsr

    3. 'vsrSub' doesn't exist.







      I would add some trace statements to test all these conditions.
  • Posted 16 September 2017, 7:55 am EST

    Can anyone help me?

    Thanks...

  • Posted 16 September 2017, 7:55 am EST

    Can you provide more detail? What is the error?











    wrote in message news:185917@test.componentone.com

    Can anyone help me?















    Thanks…

  • Posted 16 September 2017, 7:55 am EST

    Here is a copy of the code I'm using.

    SET vsr = server.CreateObject("VSReport8.VSReport")

    SET vsrSub = server.CreateObject("VSReport8.VSReport")

    vsrSub.Load "c:testwebwebSolutionsreportsWorkOrder2.xml", "subRouting" vsrSub.DataSource.ConnectionString=Session("SQLconnectionstring") vsrSub.DataSource.RecordSource = strSQL_Routing

    vsr.Load "c:testwebwebsolutionsreportsWorkOrder2.xml", "rptWorkorder" vsr.DataSource.ConnectionString=Session("SQLconnectionstring")

    vsr.Fields("subRouting").Subreport=vsrSub --->(THIS IS THE LINE THAT FAILS!!!)

    vsr.DataSource.RecordSource = strSQL_WorkOrder

    vsr.DoEvents=FALSE

    There is an include file after this that kicks off the rendering of the file with the printer control.

    All the SQL querys are in place and they do work.

    As I state in my first post, this code is being used in another page and works without any errors.

    Thanx...

  • Posted 16 September 2017, 7:55 am EST

    I tried putting some trace statements in. Everytime I put ANYTHING with



    .Fields it gives the error. Could there be something wrong with the .fields



    command from the object? Should I update to a newer build of VS VIEW?







    But this works on other apps you have, doesn't it? Switching to a newer



    build wouldn't make a difference in that case.







    How about vsr.ReportName? Does that work?

  • Posted 16 September 2017, 7:55 am EST

    In order to identify the problem, I would add some trace statements:







    vsr.Load “c:testwebwebsolutionsreportsWorkOrder2.xml”, …







    Response.Write(vsr.Fields.Count)



    Response.Write(vsr.Fields(“subRouting”).Text)



    Response.Write(vsrSub.ReportName)



    … etc …







    vsr.Fields(“subRouting”).Subreport=vsrSub —>(THIS IS THE LINE THAT



    FAILS!!!)



    vsr.DataSource.RecordSource = strSQL_WorkOrder



    vsr.DoEvents=FALSE

  • Posted 16 September 2017, 7:55 am EST

    I tried putting some trace statements in. Everytime I put ANYTHING with .Fields it gives the error. Could there be something wrong with the .fields command from the object? Should I update to a newer build of VS VIEW?

  • Posted 16 September 2017, 7:55 am EST

    This is code from the page that is working. As you can see there is not a field called subReport_Customer_Contact

    strSQL = "SELECT distinct im_cntct_tbl.im_cntct_name, im_cntct_tbl.im_cntct_title, en_cust_tbl.en_cust_key, en_cust_tbl.en_cust_name, im_cntct_tbl.im_cntct_phone, " strSQL = strSQL & "im_cntct_tbl.im_cntct_fax, im_cntct_tbl.im_cntct_moble, im_cntct_tbl.im_cntct_telex, im_cntct_tbl.im_cntct_itnet, im_cntct_nofax, im_cntct_no_email " strSQL = strSQL & "FROM im_cntct_tbl INNER JOIN (en_cstcn_tbl INNER JOIN en_cust_tbl ON en_cstcn_tbl.en_cust_key = en_cust_tbl.en_cust_key) ON im_cntct_tbl.im_cntct_key = en_cstcn_tbl.im_cntct_key " strSQL = strSQL & "INNER JOIN im_cntct_ext ON im_cntct_tbl.im_cntct_key = im_cntct_ext.im_cntct_key " strSQL = strSQL & "WHERE en_cust_tbl.en_cust_key = " & strCustomer strSQL = strSQL & " ORDER BY im_cntct_tbl.im_cntct_name" rsContact.Open strSQL, cnMain strSQLContact = strSQL end if

    if Request.Form("viewreport")="View Report" then

    set vsr = server.CreateObject("VSReport8.VSReport")

    set vsrSub = server.CreateObject("VSReport8.VSReport")

    vsrSub.Load "c:testwebwebSolutionsreportsCustomer_Info.xml", "subReport_Customer_Contact"

    vsrSub.DataSource.ConnectionString=Session("connectionstring") & ";uid=sa;pwd=essay" vsrSub.DataSource.RecordSource = strSQLContact

    vsr.Load "c:testwebwebsolutionsreportsCustomer_Info.xml", "rpt_Customer_Record" vsr.DataSource.ConnectionString=Session("connectionstring") & ";uid=sa;pwd=essay"

    vsr.Fields("subReport_Customer_Contact").Subreport=vsrSub vsr.DataSource.RecordSource = strSQLCust vsr.



    DoEvents=false

    So what does that have to do with it if this code works?

  • Posted 16 September 2017, 7:55 am EST

    This is code from the page that is working. As you can see there is not a



    field called subReport_Customer_Contact



    So what does that have to do with it if this code works?







    Sorry, I'm totally lost, have no idea what you're talking about. Let me



    start from scratch.







    Your code contains this:







    vsr.Fields(“SubRouting”).Subreport=vsrSub







    The intent of this line is to assign a subreport to the Subreport property



    of the report field “SubRouting”.







    However, the report doesn't seem to contain a field called “Subrouting”, so



    you get the error.







    This has nothing to do with your Sql statements etc. It has to do with the



    report definition itself. I suggested you inspect the field names using the



    code posted earlier, to confirm that the report doesn't really contain that



    field. Another option would be to look at the report definition (in



    “c:testwebwebsolutionsreportsWorkOrder2.xml”).







    Looking again at the code you posted earlier:







    vsrSub.Load “c:testwebwebSolutionsreportsWorkOrder2.xml”, “subRouting”



    vsrSub.DataSource.ConnectionString=Session(“SQLconnectionstring”)



    vsrSub.DataSource.RecordSource = strSQL_Routing



    It looks like “subRouting” is the name of a report, not a field.

  • Posted 16 September 2017, 7:55 am EST

    Yes...It gives me my report name and the sub report also works.

    What does the .fields actually do?

  • Posted 16 September 2017, 7:55 am EST

    Yes…It gives me my report name and the sub report also works.



    What does the .fields actually do?







    It gets the field collection. How about .Fields.Count? Does that work?

  • Posted 16 September 2017, 7:55 am EST

    Yes fields.count works...

    This is what I get for Response.Write(vsr.Fields("subRouting").Text:

    Microsoft VBScript runtime error '800a017d'

    Unknown runtime error

    /websolutions/WorkOrder_Print.asp, line 110 (This is the line of code above )

    and this for Response.Write(vsrsub.Fields):

    Response object error 'ASP 0185 : 8002000e'

    Missing Default Property

    /websolutions/WorkOrder_Print.asp, line 0

    A default property was not found for the object.

  • Posted 16 September 2017, 7:55 am EST

    This is what I get for Response.Write(vsr.Fields(“subRouting”).Text:







    Microsoft VBScript runtime error '800a017d'



    Unknown runtime error



    /websolutions/WorkOrder_Print.asp, line 110 (This is the line of code



    above )







    Looks like there's no field called “subrouting”.







    and this for Response.Write(vsrsub.Fields):







    Response object error 'ASP 0185 : 8002000e'



    Missing Default Property







    This is expected. vsrsub.fields is a collection, it has no string



    representation or default property, so you can't “write” it.







    Why don't you try this:







    for i = 0 to vsr.fields.count-1



    Response.Write(vsr.fields(i).Name)



    next







    This will list all the field names. I'm betting there's no field called



    “subRouting”.

  • Posted 16 September 2017, 7:55 am EST

    Thanks for all your help. Everything seems to be working OK now…

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels