Avatar of Norman Maina
Norman Maina
Flag for Kenya asked on

crystal report of data from multiple tables

I want to create a report that will show data from several related tables.

Say I have a table with a column named job card and I want to track what has happened to that jobcard on other tables.

Basically I wast to see a see a subset of data from other tables based on a column in one table.
Visual Basic.NETCrystal Reports

Avatar of undefined
Last Comment

8/22/2022 - Mon

Hi Norman,

go to database Expert.
then click the links tab, here you can link your tables

Norman Maina

Hi  Kingjely,

i have linked the tables OK...that works.

What am not sure about is do i have to select all the columns that i want from all the tables in the fields to display section and then group them?

What i want to achieve is query a record in a column in one table and then have results grouped according to the tables they come from.
Say I have |Tables A,B,C.

These tables are related and linked in CR...there will be only quering of values from one column in Table A...lets call it Jobcard.

I want the results for jobcard 0001 for example to show table B values in one heading and then table C values in another heading.

How can I achieve that?


Yea step through the creation wizard as best you can, you can always change fields, and groups links ect as you go.

So you have chosen your 3 tables, linked them,
Now choose your fields to display, have you done that?

So have you then grouped by Jobcard_id ?
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
Norman Maina

kingjely,i know how to create reports...what i want is to view the results grouped by the table from where they originate.

Use subreports.

Now that you have explained your required output, you need to use jayconverse's answer.

The alternative to this is to build a sql UNION query using the Add Command option.

Joins are of no use to you for this requirement.
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
Norman Maina


Can you give me a brief overview of how it works...or point me to a good resource.

Trust me,have been googling and am not sure if I need to create a report first and then create sub reports from that...

View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.

If you just want three lists based on 3 tables with the same fields then  the simplest approach with subreports is to design one report for the first table and then sinply copy and rename the rpt  file for each of the other lists.
You then need to change the table source for the other reports.
Open each one and  do that using the Database >Set DatasourceLocation menu option.

You then create a new blank report and just use insert>subreport to add the subreports to this main report.

You can then sort out the overall layout of the combined output.