Results 1 to 2 of 2
  1. #1
    roeslein is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Dec 2012
    Posts
    1

    Red face Access 2007 Summarize 2 values from subqueries and display in the main Select statemt

    Hi Folks,



    I am looking for a solution for the following problem.
    I have one table whre I like to summarize 2 values created wit different criterias.
    I tryed to create a main Sleect statement with 2 subqueries, but Iit will not work.
    The subqueries as alone Select statements working fine, here the two select commands:
    SELECT
    Count(tblRaw_Data.[Contact last Name]) AS ['Count']
    FROM tblRaw_Data
    WHERE ((tblRaw_Data.Title<>"ESPI" And tblRaw_Data.Title<>"ESPB")) and tblRaw_Data.[Account Area] = "Europe/Middle East/Africa"
    HAVING (Not tblRaw_Data.[Owner Last Name] =" ") AND (tblRaw_Data.Month=Left(MonthName(Month(Date())-1),3))

    SELECT
    Count(tblRaw_Data.[Contact last Name]) AS ['Count']
    FROM tblRaw_Data
    WHERE ((tblRaw_Data.Title="ESPI" Or tblRaw_Data.Title="ESPB") And tblRaw_Data.[Added Category]="FSSS" and tblRaw_Data.[Account Area] = "Europe/Middle East/Africa"
    HAVING ( Not tblRaw_Data.[Owner Last Name]= " ") AND (tblRaw_Data.Month=Left(MonthName(Month(Date())-1),3))

    If you can give me a hint, that should be great.
    Have a great weekend!!!

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Do not use apostrophes in defining the alias Count fieldname. Actually, Count is a reserved word. Better name would be CountRaw.

    You show a space as criteria for the OwnerLastName. Do you really want an empty string or Is Null as criteria? Will this field allowed to have space or empty string? I never allow empty string in tables.

    You show two queries but not the main with 2 subqueries. Why doesn't the 'main' work - error message, wrong results, nothing happens?

    Each of these queries will output only one record with one field. Seems the 'main' would simply be: SELECT Query1.CountRaw, Query2.CountRaw;
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Access 2007: Can't Display 17 Digit Number
    By HedgeHog in forum Access
    Replies: 9
    Last Post: 08-14-2011, 01:46 PM
  2. Replies: 2
    Last Post: 09-22-2010, 09:26 AM
  3. how to display the extension file access 2007
    By tintincute in forum Access
    Replies: 4
    Last Post: 08-04-2010, 10:09 AM
  4. Update query to summarize multiple values
    By ser01 in forum Queries
    Replies: 3
    Last Post: 05-15-2010, 09:38 AM
  5. Replies: 3
    Last Post: 03-27-2009, 06:50 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums