p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   Access (http://p2p.wrox.com/forumdisplay.php?f=18)
-   -   Count, sum, count a value, return records (http://p2p.wrox.com/showthread.php?t=28184)

CongoGrey April 15th, 2005 03:02 PM

Count, sum, count a value, return records
I am trying to count the number of times the same name
occurs in five different fields.

I want to sum the counts of fields 2 - 5,[Other1, Other2, etc.]
and display them in a report side by side with the sum
of the occurences of each name in the first field [LeadName].

The Name fields actually contain a number ("Long Interger")
that is related to an ID number in another "look-up"

A problem I am having:

1) The LeadName qry/qryctab/rpt works fine - all names in the list
display with their associated count sums sorted by month.

    Oct Nov Dec TotalLead
Smith 1 2 3
Jones 1 4 5

However, when I try to add Other1, which also sorts and
displays correctly as a stand-alone, I find it has a different
number of names because not all names had values in the "other"
fields. When I join "Other1" query with the "LeadName" query, only
names with matching name values are returned. ex: QryLeadName number of records is 33, QryOther1 number of records is 5. When I try to make a multiple value field query, only 5 records (those appearing in both QryOther1 and QryLeadName) are returned.

How do I display all the names in the Name list - even thoses with
no records? There are no "null" or "zero-strings" in any fields.

ex: Other1 = 31 ("none" in look-up table).

Ideally, I would like to just have a single sum for fields 2 - 5

AprilTrip LeadName = 12 "Smith" Other1= 13 Other2=14 "Brown"
AprilTrip LeadName = 13 "Jones" Other = 12 Other2=31 "none"

    Smith 1/1 (Trip as lead = 1, Trip as Other = 1
    Jones 1/zero or blank (Trip as lead = 1, Trip as Other = 0

Right now "Jones" has no return because she has no associated record in the "Other" query. I'm getting so confused!

SerranoG April 18th, 2005 02:25 PM

In your query, you have probably joined the primary key of one table to the foreign key of the other. In design view, double-click the line joining them (take good aim; it's hard to hit) and select the join type you'd like. You probably want the second of three, but read your choices carefully.

Greg Serrano
Michigan Dept. of Environmental Quality, Air Quality Division

All times are GMT -4. The time now is 01:18 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.