Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access
Password Reminder
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old April 15th, 2005, 03:02 PM
Registered User
Join Date: Apr 2005
Location: Boston, MA, USA.
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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!

Reply With Quote
  #2 (permalink)  
Old April 18th, 2005, 02:25 PM
Friend of Wrox
Points: 4,007, Level: 26
Points: 4,007, Level: 26 Points: 4,007, Level: 26 Points: 4,007, Level: 26
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Jun 2003
Location: Lansing, Michigan, USA.
Posts: 1,151
Thanks: 2
Thanked 14 Times in 14 Posts
Send a message via ICQ to SerranoG Send a message via AIM to SerranoG

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
Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Sum and Count - Please Help deepsea007 XSLT 9 June 21st, 2007 02:46 PM
Using count or sum to validate radiobutton rdove84 SQL Server ASP 0 November 8th, 2006 04:17 PM
How to get "SELECT COUNT(*)" return information? datagram ASP.NET 1.0 and 1.1 Basics 3 December 23rd, 2004 01:21 AM
sql to return distinct count pbgurl Access VBA 2 October 29th, 2004 06:29 AM
return record count by quarter jtyson SQL Server 2000 1 June 29th, 2004 11:24 PM

All times are GMT -4. The time now is 02:25 PM.

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