|
-
Jul 4th, 2008, 08:06 AM
#1
Thread Starter
Fanatic Member
Report based on multiple tables
Finally after a year I was able to make a report that is based on 1 table. This works. Before I explain my problem let me first tell you how I got my 1 table report to work.
I am using VB 2008 with an ACCESS 2007 database.
I made a form on wich I planted a crystal report viewer.
Then I created a new crytal report using the wizzard and used the ADO.NET datasets wich I am currently using in my programm.
So I selected a dataset and build the report.
Then..on the form where my crystal report viewer resides I inserted the following code:
Code:
Public Class testreports
Private Sub testreports_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'TODO: This line of code loads data into the 'Land_DataSet.tblLAND' table. You can move, or remove it, as needed.
Me.tblLANDTableAdapter.Fill(Me.Land_DataSet.tblLAND)
Dim rpt As New testCRYSTALREPORT
rpt.SetDataSource(Land_DataSet)
Me.CrystalReportViewer1.ReportSource = rpt
End Sub
End Class
This works perfectly...
But now I want to make a report based on 2 or more tables but then it doenst work.
How do I go about this?
-
Jul 4th, 2008, 08:31 PM
#2
Hyperactive Member
Re: Report based on multiple tables
I haven't used the Datasets yet myself but you would create a dataset with the correct tables and fields, similar to recordsets in VB6. Pull the data from the correct tables and then pass them to the report.
-
Jul 8th, 2008, 12:18 PM
#3
Thread Starter
Fanatic Member
Re: Report based on multiple tables
I have created a query in my access 2007 database (qryBedrijfsgegevens) and created a report based on that query. First I added a dataset to the form the crystalreport viewer is on.
This is the code I use:
Code:
Public Class testreports
Private Sub testreports_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'TODO: This line of code loads data into the 'Land_DataSet.tblLAND' table. You can move, or remove it, as needed.
Me.QryBEDRIJFSGEGEVENSTableAdapter1.Fill(Me.BedrijfsgegevensOverzicht_DataSet1.qryBEDRIJFSGEGEVENS)
Dim rpt1 As New test
rpt1.SetDataSource(BedrijfsgegevensOverzicht_DataSet1)
Me.CrystalReportViewer2.ReportSource = rpt1
End Sub
End Class
Now I get the following error: OLEDBExeption was unhandled
The error is traced to this line of code:
Me.QryBEDRIJFSGEGEVENSTableAdapter1.Fill(Me.BedrijfsgegevensOverzicht_DataSet1.qryBEDRIJFSGEGEVENS)
I realy hope somebody can help me
-
Jul 8th, 2008, 12:27 PM
#4
Frenzied Member
Re: Report based on multiple tables
where is BedrijfsgegevensOverzicht_DataSet1 being created?
-
Jul 8th, 2008, 01:06 PM
#5
Thread Starter
Fanatic Member
Re: Report based on multiple tables
 Originally Posted by Besoup
where is BedrijfsgegevensOverzicht_DataSet1 being created?
I dragged it on the form from components.
-
Jul 8th, 2008, 01:16 PM
#6
Frenzied Member
Re: Report based on multiple tables
ok well I am pretty sure that you cannont just fill a dataset with another dataset... which would probably cause that problem.
From what I understand you're trying to display data from 2 seperate tables. Is there any relationship between the 2 tables?
-
Jul 9th, 2008, 12:30 AM
#7
Thread Starter
Fanatic Member
Re: Report based on multiple tables
 Originally Posted by Besoup
ok well I am pretty sure that you cannont just fill a dataset with another dataset... which would probably cause that problem.
From what I understand you're trying to display data from 2 seperate tables. Is there any relationship between the 2 tables?
Indeed... I made a query in ms access 2007 and created a dataset from that query.
There is no relation defined between the 2 tables...but is that necessary?
Isnt there a tutorial of how to make and then connect to a crystal report?
I have googled for the last 2 months and came up with what I have so far.
-
Jul 9th, 2008, 05:36 AM
#8
Frenzied Member
Re: Report based on multiple tables
are you doing anything with the data in .net?
If you're not you should be able to connect the crystal report directly to the query in the access database.
-
Jul 9th, 2008, 06:46 AM
#9
Thread Starter
Fanatic Member
Re: Report based on multiple tables
 Originally Posted by Besoup
are you doing anything with the data in .net?
If you're not you should be able to connect the crystal report directly to the query in the access database.
Is there a tutorial of how to do that?
-
Jul 9th, 2008, 06:57 AM
#10
Frenzied Member
Re: Report based on multiple tables
not sure... what version of CR are you using?
-
Jul 9th, 2008, 08:07 AM
#11
Thread Starter
Fanatic Member
Re: Report based on multiple tables
 Originally Posted by Besoup
not sure... what version of CR are you using?
I am at work..
So I cant check right nog.
But the one that comes with Visual Studio 2008
-
Jul 11th, 2008, 12:45 AM
#12
Thread Starter
Fanatic Member
Re: Report based on multiple tables
Can anybody please help me?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|