Welcome to SPN

Register and Join the most happening forum of Sikh community & intellectuals from around the world.

Sign Up Now!

Problems with dates in DCounts

Discussion in 'Information Technology' started by Adam Thwaites, Jul 28, 2006.

  1. Adam Thwaites

    Adam Thwaites
    Expand Collapse
    Guest

    The following code is supposed to count how many calls an agent has logged on
    this particular day, but it is returning the total number of calls made ever.
    Can anyone see a problem with the date part?

    lblCalls.Caption = DCount("*", "tbl_Main", "[AgentName]=""" &
    [Forms]![frm_CallLogger]![txtAgentName] & """ And """ & "[SaveDate]=
    DateValue(now)""")

    Also I also want to build the date filter on this DCount but I can't get it
    to work:

    lblUpsells.Caption = DCount("*", "tbl_Main", "[AgentName]=""" &
    [Forms]![frm_CallLogger]![txtAgentName] & """ And " & "[OutcomeFlush]=" &
    "true" And """ & "[SaveDate]= DateValue(now)""")

    Thanks for any help you can offer!
    --
    Adam Thwaites
    Access Database Designer
    adam.thwaites.remove@thisbit.mercedes.co.uk
    Manchester, UK
     
  2. Loading...

    Similar Threads Forum Date
    Sikh News Sikhs Face Problems While Carrying Kirpans In Khyber-Pakhtunkhwa - SikhSiyasat.Net Breaking News Jul 29, 2016
    "Dasam" Granth - A Look At The Core Problems Dasam Granth Oct 21, 2015
    Problems In Life Sikh Sikhi Sikhism Apr 13, 2015
    Muslim Girl-Sikh Boy Marriage Problems- Please Help! Love & Marriage Oct 12, 2012
    Problems with Sikh Historiography-prof Jagdish Singh Sikh Video Aug 31, 2012

  3. Douglas J Steele

    Douglas J Steele
    Expand Collapse
    Guest

    Try:

    lblCalls.Caption = DCount("*", "tbl_Main", "[AgentName]=""" &
    [Forms]![frm_CallLogger]![txtAgentName] & """ And """ & "[SaveDate]=" &
    Format(Date, "\#mm\/dd\/yyyy\#"))

    Same for the other one: put the date outside the quotes, use # delimiters
    and format it as mm/dd/yyyy, regardless of what your Short Date format has
    been set to. (the Format statement I'm using above does both the delimiter
    and format for you)

    --
    Doug Steele, Microsoft Access MVP
    http://I.Am/DougSteele
    (no e-mails, please!)


    "Adam Thwaites" <AdamThwaites@discussions.microsoft.com> wrote in message
    news:84C89F57-5F7E-4C9D-B913-4932AAFA21D1@microsoft.com...
    > The following code is supposed to count how many calls an agent has logged

    on
    > this particular day, but it is returning the total number of calls made

    ever.
    > Can anyone see a problem with the date part?
    >
    > lblCalls.Caption = DCount("*", "tbl_Main", "[AgentName]=""" &
    > [Forms]![frm_CallLogger]![txtAgentName] & """ And """ & "[SaveDate]=
    > DateValue(now)""")
    >
    > Also I also want to build the date filter on this DCount but I can't get

    it
    > to work:
    >
    > lblUpsells.Caption = DCount("*", "tbl_Main", "[AgentName]=""" &
    > [Forms]![frm_CallLogger]![txtAgentName] & """ And " & "[OutcomeFlush]=" &
    > "true" And """ & "[SaveDate]= DateValue(now)""")
    >
    > Thanks for any help you can offer!
    > --
    > Adam Thwaites
    > Access Database Designer
    > adam.thwaites.remove@thisbit.mercedes.co.uk
    > Manchester, UK
     

Share This Page