Ms-access – How to conditionally summarize multiple rows in Microsoft Access

ms accessunion

I have a table of data, in Microsoft Access 2003, listing multiple rows for each person.

I want to conditionally summarize a subset of these rows for each person, for instance, if entry for columnA = "Hats".

I've made summary tables for each (with the conditional checking) and I want to UNION the master table and the summary tables together, however each table has a different number of columns. Am I going to have to redesign my summary tables so they match the columns in the master, or is there a clever way of doing this?

I've tried to join them first (do I even need to do this?), and also to UNION CORRESPONDING them together, but MS Access doesn't understand that command it seems.

How should I do this?

Edit, here is a mockup of my master table data:

ResID| Name|  Baselocation|  Destination| CustomerID  |   Project ID    p1    p2    p3
---------------------------------------------------------------------------------
001  |  Bob|  London      |  D-London   | Company     |   "BaseWork"    X%    y%    z%
                             N/A        | myOwnCompany|   "Overhead"    x%    y%    z%
                             D-NotLondon| Company     |    Project      x%    y%    z% 
                             D-London   | Company     |    Project2     x%    y%    z%

Best Answer

I'd also like to see the ERD (Entity Relationship Diagram) to get a better understanding of your problem.

I'm thinking if you're creating a report to present the data in this fashion, you can setup a grouping based on an expression, either using built-in functions or use a user-defined function in a VBA module.