Results 1 to 10 of 10
  1. #1
    Join Date
    Oct 2009
    Posts
    24

    Unanswered: Dcount on report help...

    What I want:
    I want report to show the # of orders for a user specified date in frmWhatDates based off of query qryTotal_Orders.

    I'm having trouble getting a dcount expression to work in my report. Can anyone help my correct my syntax?

    Main form: frmShipments
    1. Click "preview report" command button
    a. frmWhatDates appears
    b. user enters mm/dd/yyyy and clicks "generates report" command button
    c. report display # of orders for date entered in text box

    Text boxes on report:
    1. Date - Displays date entered: works successfully.
    =[Forms].[frmWhatDates].[txtOrderDate]

    2. Total Orders count for date entered: (example: 327) #Error - NEED HELP
    =DCount("[OrderDate]","qryTotal_Orders","[OrderDate] = " & [Forms].[frmWhatDates].[txtOrderDate] & "")

    What am I doing wrong? Thanks in advance for any help.

  2. #2
    Join Date
    May 2005
    Location
    Nevada, USA
    Posts
    2,888
    Provided Answers: 6
    See if this helps:

    General: DLookup Usage Samples
    Paul

  3. #3
    Join Date
    Oct 2009
    Posts
    24
    It's still not happy... I'm using access 2000.

    =DCount("[OrderDate]","test_qry","[OrderDate] = " & [Forms]![frmWhatDates]![txtOrderDate] & "#")

  4. #4
    Join Date
    May 2005
    Location
    Nevada, USA
    Posts
    2,888
    Provided Answers: 6
    You missed the preceeding #.
    Paul

  5. #5
    Join Date
    Oct 2009
    Posts
    24
    =DCount("OrderNumber","test_table","OrderDate = #" & [Forms]![frmWhatDates]![txtOrderDate] & "#")

    You're correct.... thanks a lot.

  6. #6
    Join Date
    May 2005
    Location
    Nevada, USA
    Posts
    2,888
    Provided Answers: 6
    No problemo, and welcome to the site by the way.
    Paul

  7. #7
    Join Date
    Oct 2009
    Posts
    24
    I'm trying to take this one step farther... Can anyone assist with my syntax below??

    =DCount("[OrderNumber]","tblOutbound_Orders","[OrderDate] Between " & _ Format([Forms]![frmWhatDates]![txtStartDate], "\#mm\/dd\/yyyy\#") & _ " And " & _ Format([Forms]![frmWhatDates]![txtEndDate], "\#mm\/dd\/yyyy\#")

  8. #8
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    =DCount("[OrderNumber]","tblOutbound_Orders","[OrderDate] Between #" & Format([Forms]![frmWhatDates]![txtStartDate], "mm/dd/yyyy") & "# And #" & Format([Forms]![frmWhatDates]![txtEndDate], "mm/dd/yyyy") & "#")
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

  9. #9
    Join Date
    Oct 2009
    Posts
    24
    Thanks StarTrekker!!

  10. #10
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    You're welcome
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •