Click here to Skip to main content
15,879,326 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hello everyone,
I am currently developing a project in VB.Net and Ms Access and now, I got stuck while creating a crystal report where I need to display columns from three access tables which I am able to fetch using a query in Access. But the problem is that I am not able to create a crystal report and display the result of that query on the crystal report.
I have already created one crystal report which displays that records of an access table on the crystal report with the following code
VB
Private Sub frmReportProcedures_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
       Dim ds As New DataSet4
       Dim ad As New DataSet4TableAdapters.proceduresTableAdapter
       ad.Fill(ds.procedures)
       Dim rpt As New rptAllProcedures
       rpt.SetDataSource(ds)
       CrystalReportViewer1.ReportSource = rpt
   End Sub

This crystal report is working just fine.
Now, I just wanted to know how to create crystal report from the following SQL query
SQL
SELECT patients.patient_name, patients.residence, patients.contact, patients.procedure_date, patientprocedures.procedures, patientprocedures.procedure_cost, payments.amountPaid, payments.paymentDate
FROM (patients INNER JOIN patientprocedures ON patients.patient_id=patientprocedures.patient_id) INNER JOIN payments ON patients.patient_id=payments.patient_id;

Hope, I will get some help from you friends.
Thank you

What I have tried:

I have already coded the whole project except this report. I have already created a report which if display all the records of procedures table with the following code
VB
Private Sub frmReportProcedures_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
       Dim ds As New DataSet4
       Dim ad As New DataSet4TableAdapters.proceduresTableAdapter
       ad.Fill(ds.procedures)
       Dim rpt As New rptAllProcedures
       rpt.SetDataSource(ds)
       CrystalReportViewer1.ReportSource = rpt
   End Sub
Posted
Comments
Andre Oosthuizen 26-Jan-23 8:41am    
Here is a tutorial on how to create a CR using SQL - http://vb.net-informations.com/crystal-report/crystal_report_from_sql_query_string.htm

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900