SubReport problem

Originally Posted 6 September 2006, 3:00 am EST

  • Originally Posted 6 September 2006, 3:00 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

  • Reply

    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?

  • Reply

    Can anyone help me?


     


    Thanks...

  • Reply

    > 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.
  • Reply

    Can you provide more detail? What is the error?





    <jrebocho> wrote in message news:185917@test.componentone.com...

    > Can anyone help me?

    >

    >

    >

    > Thanks...

    >
  • Reply

    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...

  • Reply

    >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?
  • Reply

    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
  • Reply

    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?
  • Reply

    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?

  • Reply

    > 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.
  • Reply

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


    What does the .fields actually do?

  • Reply

    > 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?
  • Reply

    Yes fields.count works...


     


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


    Microsoft VBScript runtime error '800a017d'
    <P>Unknown runtime error
    <P>/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'
    <P>Missing Default Property
    <P>/websolutions/WorkOrder_Print.asp, line 0
    <P>A default property was not found for the object.

  • Reply

    > 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".
  • Reply

    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