Report showing totals from two tables

  • Thread starter ThomasK via AccessMonster.com
  • Start date
T

ThomasK via AccessMonster.com

I am trying to create a report showing total counts from two related tables.
I have two tables, Inspections and Reinspections. Inspections has as it's
fields, InspectionID (PrimaryKey), InspectionType, Inspector, InspectionDate.
Reinspections has ReinspectionID (PrimaryKey), InspectionID (ForeignKey),
ReinspectionDate. They are linked one to many, one inspection to many
reinspections. Each inspection may be one of several type, but each
inspection regaurdless of type may have several reinspections. There is only
one type of reinspection.

What I want is a report showing the total count of inspections by type, and
the total count of reinspections. These would be over a certain time period,
(Between_And_). I dont want any other data on the report, and I don't want to
show them by InspectionID. Showing them by InspectionID would separate them
on the page and not give me just the grand total by type.

Can I do this with one query?
Should I use two queries and get the totals first?
Can I do this without listing them by InspectionID?

Thanks,
 
G

Guest

I would probably create two queries that return the result you want to
report. Use one query as the record source of a main report and the other as
the record source of a subreport. You may need to place the subreport in the
main report's header or footer.
 
T

ThomasK via AccessMonster.com

OK, I made two queries and got the records that I wanted in each. I made a
report based on the Inspection table query and then used =DCount("
[InspectionID]","QTest1","[InspectionType] = 'General Insp'") in a text box
in the page footer to get the counts that I need. Then I made a query and
report using the same method for the reinspections table. The problem that
I'm having now is when trying to put the unrelated reinspection subreport
into the inspection report. They can not be related to do what I need. Can I
put two unrelated reports into a single report? I tried to put it into the
page footer.

Thanks for your help!
 
G

Guest

You can create a main report with multiple subreports. I wouldn't put them in
the page footer since the section can't grow.
 
T

ThomasK via AccessMonster.com

Thanks,
The problem that I'm still having is that I can't seem to get the total of
reinspections on the same report. I've made a report based on the inspections
table and I can get the totals of each type of inspection on it, but I can't
get the total of reinspections on the same report with a subreport. It wants
me to link the two by inspection ID. I know linking the two tables is the way
its normally done but that makes it imposible to get just the total counts on
the different types of inspection (from the inspection table) and the total
counts from the reinspection table.
Am I just doing this wrong? It seems like it should be easy to get these
totals into a report.
 
G

Guest

I don't think you want any linking. Just delete the Link Master/Child
property values.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top