Im using Access 2007 to import statistics (Excel) from multiple units within a department. Although they share similar fields, each Unit has it’s own table because they also have unit specific data/fields that needs to be tracked.
Table:UnitA -(Fields:Date,Cars, Boats, Tags, Guns, Missing Persons, etc.)
Table:UnitB -(Fields:Date,Cars, Boats, Tags, Guns, Bench Warrants, etc.)
Table:UnitC -(Fields:Date, Cars, Boats, Tags, Guns, Fingerprints, etc.)
I need to create a summary report that queries a START DATE and END DATE and then produces a report that will display:
Sums of each of the individual fields from each record ie Sum([Fingerprints])
Sums of each of the shared fields from each record ie Sum([UnitA!Cars]) + Sum([UnitB!Cars]) etc.
I can create a report for each individual unit without any problems.
My problem begins when I ceate three Unit reports and try to use subreports. Access will prompt me for new Start Dates and End Dates.
Does anyone have a better solution? Should I create a “prompt” form that includes a Start Date and End Date field that can be accessed from within each query?
You can create a single query by using unions
You must have the same number of fields in each SELECT. The field names of the first SELECT will be used for the result.
However, I suggest another DB design. Place all the commom fields in a common table and place the unit-specific fields in other tables that you join in a 1-to-1 relation
Now you can create a query with left joins.
An even easier design is to create just one table, and to allow empty fields
Instead of importing the excel tables directly, just link the excel tables and then append their content to the common table with customized append queries.