Union Query

Discussion in 'Microsoft Access Queries' started by Guest, Apr 5, 2005.

  1. Guest

    Guest Guest

    I hope some one can help me i have this folling query and it gives me the
    correct count for Record No for the month 1 and 2 but when it does the Dcount
    for Elapse Time it gives only the count for Month 1 and for Month 2 it gives
    me the exact ones as for Month 1 and not the ones for Month 2, could sone one
    tell me what i am doing wrong

    Regards Markus

    SELECT Count([Record No]) AS [RecordNo], Dcount("[Elapse time required to
    resolve]","New All Query","[Elapse time required to resolve]='Less Then 24
    Hours'") AS [Elapsetime Less then 24 Hours]
    FROM [New All Query]
    Having (((Month([Date of Call]))=1));
    Union All SELECT Count([Record No]) AS [RecordNo], DCount("[Elapse time
    required to resolve]","New All Query","[Elapse time required to
    resolve]='Less Then 24 Hours'") AS [Elapsetime Less then 24 Hours]
    FROM [New All Query]
    Having (((Month([Date of Call]))=2));
     
    Guest, Apr 5, 2005
    #1
    1. Advertisements

  2. Guest

    Carl Rapson Guest

    You need to move your Having clause into the DCount as a WHERE clause:

    ...."[Elapse time required to resolve]='Less Then 24 Hours' AND [Date of
    Call]=1"

    and

    ...."[Elapse time required to resolve]='Less Then 24 Hours' AND [Date of
    Call]=2"

    Otherwise, nothing differentiates the two DCount calls and you'll get the
    same value for both calls.

    Carl Rapson

    "Markus" <> wrote in message
    news:...
    >I hope some one can help me i have this folling query and it gives me the
    > correct count for Record No for the month 1 and 2 but when it does the
    > Dcount
    > for Elapse Time it gives only the count for Month 1 and for Month 2 it
    > gives
    > me the exact ones as for Month 1 and not the ones for Month 2, could sone
    > one
    > tell me what i am doing wrong
    >
    > Regards Markus
    >
    > SELECT Count([Record No]) AS [RecordNo], Dcount("[Elapse time required to
    > resolve]","New All Query","[Elapse time required to resolve]='Less Then 24
    > Hours'") AS [Elapsetime Less then 24 Hours]
    > FROM [New All Query]
    > Having (((Month([Date of Call]))=1));
    > Union All SELECT Count([Record No]) AS [RecordNo], DCount("[Elapse time
    > required to resolve]","New All Query","[Elapse time required to
    > resolve]='Less Then 24 Hours'") AS [Elapsetime Less then 24 Hours]
    > FROM [New All Query]
    > Having (((Month([Date of Call]))=2));
     
    Carl Rapson, Apr 5, 2005
    #2
    1. Advertisements

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Similar Threads
  1. Brooks Friend

    query with criteria promt will not carry forward after a union query

    Brooks Friend, Jul 31, 2003, in forum: Microsoft Access Queries
    Replies:
    0
    Views:
    536
    Brooks Friend
    Jul 31, 2003
  2. Guest

    To union query or not to union query

    Guest, Feb 3, 2005, in forum: Microsoft Access Queries
    Replies:
    2
    Views:
    867
    Guest
    Feb 4, 2005
  3. Olga

    UNION or UNION ALL query question

    Olga, Apr 6, 2006, in forum: Microsoft Access Queries
    Replies:
    2
    Views:
    1,013
    Guest
    Apr 6, 2006
  4. Guest

    UNION vs UNION ALL

    Guest, Jul 31, 2006, in forum: Microsoft Access Queries
    Replies:
    1
    Views:
    750
    Michel Walsh
    Jul 31, 2006
  5. Phil Smith

    A union B works, A union B union C fails

    Phil Smith, Nov 28, 2006, in forum: Microsoft Access Queries
    Replies:
    2
    Views:
    868
    Phil Smith
    Nov 29, 2006
  6. kev100 via AccessMonster.com

    Can 2 Union Queries Be used in Another UNION ??

    kev100 via AccessMonster.com, Jul 30, 2007, in forum: Microsoft Access Queries
    Replies:
    2
    Views:
    504
    Guest
    Jul 30, 2007
  7. Union or Union All

    , Feb 5, 2008, in forum: Microsoft Access Queries
    Replies:
    4
    Views:
    381
    KARL DEWEY
    Feb 5, 2008
  8. Union or Union All

    , Feb 5, 2008, in forum: Microsoft Access Queries
    Replies:
    2
    Views:
    479
    Marshall Barton
    Feb 5, 2008
Loading...