none
Customer Invoice RRS feed

  • Question

  • Hi,

    I have one(1) internal dataset with two tables. A customer table has the Customer Key and indicative data(there are many Customers). The Purchased Item Table has the Customer Key and various indicative data. There is a one to many relationship between the Customer and the Purchased Items. I want to have a simple report that displays the Customer and his Purchased Items. I tried using the Table control but it would not let me mix data from 2 separate tables. Is there an example or easy answer on how to do this. I tried sub-reports but cannot get that working.

    Thursday, June 9, 2011 11:00 PM

Answers

  • I read all the info on the website. I created a subreport as suggested. I am now getting "Unable to load data in the subreport, check the log". I set up the handler to load the datatable: Private Sub Form77_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load AddHandler Me.ReportViewer1.LocalReport.SubreportProcessing, AddressOf MySubreportEventHandler End Sub Private Sub MySubreportEventHandler(ByVal sender, ByVal e) Dim RDS As New Microsoft.Reporting.WinForms.ReportDataSource("Dataset1", dtItemsBindingSource.DataSource) e.DataSources.Add(RDS) End Sub It does fire. The datasource does point to the datatable. But each subreport gets the same error. Any ideas? Jim
    • Marked as answer by jpalatine Monday, June 13, 2011 8:43 PM
    Friday, June 10, 2011 1:47 PM

All replies

  • Subreports is how you should do it. Did you try the examples at www.gotreportviewer.com?

    An alternate solution is to merge your two datasets. It creates alot of extra data, but sometimes makes the reports easier. For example;

    Table 1 has CustomerName, Address, City, State, Zip

    Table 2 has CustomerName, ItemNumber, Description, Price

    Merge these two together so you have a table that contains these fields;

    New Table has CustomerName, Address, City, State, Zip, ItemNumber, Description, Price

    Each row in the new table is one item from your previous Pruchased Item table. The customer demographic data is duplicated many times, but you can then group on CustomerName and use the ItemNumber, Description, and Price as the details fields.

    Does this make sense?

    Hopefully you'll get the subreports working, when they work they are great. My experience in VS2010 is been much less satisfacturary than with VS 2008.

    Bernie

     

    Friday, June 10, 2011 6:01 AM
  • Thanks for the help. I'll go there and try their examples. This is frustrating beyond belief. Can you recommend any good books on VS2010 reports? The older ones bare no resemblance to 2010. They all talk how easy it is to set a parameter and go. I think my basic problem with subreports is that I do not understand how they are created. A simple drag and drop just gives me a grayed area on the master form. If I create it separately, then I can't hook it to the master form. We'll see. Jim
    Friday, June 10, 2011 12:04 PM
  • I read all the info on the website. I created a subreport as suggested. I am now getting "Unable to load data in the subreport, check the log". I set up the handler to load the datatable: Private Sub Form77_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load AddHandler Me.ReportViewer1.LocalReport.SubreportProcessing, AddressOf MySubreportEventHandler End Sub Private Sub MySubreportEventHandler(ByVal sender, ByVal e) Dim RDS As New Microsoft.Reporting.WinForms.ReportDataSource("Dataset1", dtItemsBindingSource.DataSource) e.DataSources.Add(RDS) End Sub It does fire. The datasource does point to the datatable. But each subreport gets the same error. Any ideas? Jim
    • Marked as answer by jpalatine Monday, June 13, 2011 8:43 PM
    Friday, June 10, 2011 1:47 PM