crystal report subreport in visual basic

Posted on 2006-05-31
Last Modified: 2012-06-21
Dear Expert,
I can't add subreport into crystal report template in visual basic. Do you have any example of subreport in visual basic using crystal report. The code is as follows:
Dim rpt As New rptProfile, f As New frmReport, rs As New ADODB.Recordset, rptFather As New rptFather
   sSQL = "SELECT PersNo, Rank,  NameEnglish, NameBangla, Picture, Decoration, ArmsSvc, " _
   & "Unit, Station, Course,CommissionDate, AntiDate,RetDateByAge,  RetDateByService, " _
   & "PresentRankDate, GcNoAcademy, ApptAcademy, BirthDate, BirthPlaceDist, " _
   & "BirthPlaceCountry, Hieght, Weight, BloodGP, MedCat, IDMk, Religion, Ethnic, PassportNo, " _
   & "IssueDate, IssuePlace, ContactNoTel, ContactNoMobile, Email, PresentHouseNo, PresentRdNo, " _
   & "PresentSecNo, PresentVill, PresentPo, PresentUzThana, PresentDist, PermanentHouseNo, " _
   & "PermanentRdNo, PermanentSecNo, PermanentVill, PermanentPo, PermanentUzThana, " _
   & "PermanentDist, TINNo, DetailsSyInfo, Piculiarity, Others, Remarks " _
   & "FROM PersonalInformation Where PersNo = '" & cboPersNo.Text & "-" & txtPersNo & "'"
   Set rs = Cn.Execute(sSQL)
   If rs.EOF Then
       MsgBox "No Records to display in the report...", vbInformation
       Exit Sub
   End If
   Screen.MousePointer = vbHourglass
   rpt.Database.Tables(1).SetDataSource rs
   sSQL = "SELECT r.Fullname,b.BirthDate,b.AppxAge, b.BirthPlace,b.Nationality,b.Religion," _
   & "b.PermanentHouseNo,b.PermanentRoadNo,b.PermanentSec,b.PermanentVill,b.PermanentPo,b.PermanentUzThana," _
   & "b.PermanentDist,r.PresentHouseNo,r.PresentRoadNo,r.PresentSec,r.PresentVill," _
   & "r.PresentPo,r.PresentUzThana,r.PresentDist,b.HigestEduQua,s.LastOccupation," _
   & "b.PoliticalParty,b.politicalAppt,s.PersNo,s.LastDept,s.Rank,b.DependancyOnOffice " _
   & "from RelativeBiography b, RelativeInfo r,RelativeService s " _
   & "WHERE r.Rel_id *= b.Rel_id AND r.Rel_id *= s.Rel_id AND r.EmpPersNo = '" & cboPersNo.Text & "-" & txtPersNo & "'"
   Set rs = Nothing
   Set rs = New ADODB.Recordset
   Set rs = Cn.Execute(sSQL)
   rptFather.Database.Tables(1).SetDataSource rs
   f.CRV.ReportSource = rpt
   f.WindowState = vbMaximized
   Screen.MousePointer = vbDefault
   f.Show 1
Question by:raju1
    1 Comment
    LVL 100

    Accepted Solution


    Featured Post

    Threat Intelligence Starter Resources

    Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

    Join & Write a Comment

    I hate sub reports and always consider them the last resort in any reporting solution.  The negative effect on performance and maintainability is just not worth the easy ride they give the report writer.  Nine times out of ten reporting requirements…
    Hello everyone, Hope you find this as helpful as we did. We have on the company I work for an application built in Delphi V with Crystal Reports 8. We all know that Crystal & Delphi can be temperamental sometimes and the worst thing is, nearly…
    This video is in connection to the article "The case of a missing mobile phone (". It will help one to understand clearly the steps to track a lost android phone.
    In this sixth video of the Xpdf series, we discuss and demonstrate the PDFtoPNG utility, which converts a multi-page PDF file to separate color, grayscale, or monochrome PNG files, creating one PNG file for each page in the PDF. It does this via a c…

    745 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now