×

Loading...

Topic

This topic has been archived. It cannot be replied.
  • 工作学习 / IT技术讨论 / Help. I try to use Crystal Report in VB. But this is the first time. Who has this kind of experiences?
    • i have this kind experiences, what do you want? i can try!
      • Hi, sorry to be late. I just eat my supper. I try to use subreport.
        My report is in the following way, I built a report of person, then in the report head, I have the basic person inforation, such as name, address. and then i add a sub report which is about the education of this person, and another subreport is about Career. I use personid in every report database. but I can not know how to use subreport. when i preview the print, i can not see any record in subreport.
        Thank you.
        • ok, no matter you use a same database or different database in a crystal reports and its subreports,
          本文发表在 rolia.net 枫下论坛you can try the following two ways:
          1- use dsn. in each report/subreports, you set your dsn respectively, which actually get you the data from the tables/views in the database, and then in all your subreports you use the record selection function to filter and match you data for the subreports, this is the old way, if your tables/views hold huge data that would be very slow to show the whole reports;
          2- use ttx/ado. in your main report/subreports, set the database sourse to a series of ttx files, and then in your program you call the sp to get the reqiured recordset, and then send the setdata command to the crystal reports, and show the reports. you also should set the record selection fomular in your subreports to get the matched data for it. this would give u the best perfomance coz the recordset returned is filtered instead of the whole table.
          in both situation, you should make sure you have set the field link for your main report and subreports so that the record selection function in your subreports would work.

          good luck to you!更多精彩文章及讨论,请光临枫下论坛 rolia.net
          • sorry, I can not. the details are as following:
            本文发表在 rolia.net 枫下论坛i use ttx/ado to build the report, for each report (main report and subreport) there is only one database. for every database, there is a field 'PersonID'.
            i do not know how to build the link of database between main report and sub report. i thought the relationship are built automatically.
            in the program, i open main database by "grptReport.Database.SetDataSource rstemp, , 1",
            and then Set objSubReport = objSection.ReportObjects.Item(nIndex).OpenSubreport, objSubReport.Database.SetDataSource rstemp
            then the following error occured:
            report (main): database
            run-time error '-2147417848'
            method 'viewreport' of object 'ICrystalReportViewer' failed.
            when i put the subreport personeducation into the report' reportheader.


            I use Crystal Report the first time. So sometimes, I even do not know why the error occur. And I do not know if it is caused by Crystal Report itself since I do not install it correctly.


            i have been working on this problem for 3 days. but i can not solve it. my email is bahaiyan@hotmail.com. if you do not mind would you pls tell me your phone and i can ask you in details.

            Thanks again.更多精彩文章及讨论,请光临枫下论坛 rolia.net
          • now, the problem is "file can not find", this is for sub report. if i did not set database for subreport, then the main report is right.
            • ok give me a call in you like.