Results 1 to 4 of 4

Thread: DCount Question

  1. #1
    Join Date
    Jun 2007
    Posts
    74

    Unanswered: DCount Question

    For my Remote Call Observation DB I have had the observers filling out observation forms for a week. I am now ready to start creating reports based on those observations.

    The observation form consists of a few textboxes, combo boxes, and 33 questions that are in option groups with a Yes, No, or N/A checkbox. When the data is written to the table I have the question data going into columns named 1, 2, 3, 4, 5, etc... (more on the naming convention later.) The value written to the table is either a 1 for Yes, a 2 for No, or a 3 for N/A.

    My form that I am using to generate the report allows the user to select various criteria, includeing the Site and Project they are observing calls for, and a date range for the report.

    Once the user selects the criteria, the data meeting the criteria is written to a temp table. Then the fun begins.

    I need to be able to count the number of Yes, No, and N/A answers in the temp table so that I can build some metrics for the report. So the reason that I named the columns 1, 2, 3, 4, 5, etc... is so I could use DCount abd loop through then like this:

    Code:
     
    intYES = 0
    For i = 1 To 34
        intYES = intYES + DCount(i, "[REPORT]", i = 3)
    Next i
    So through each loop, i is incremented until all 33 columns have been checked. I would do this once for Yes, once for No, and once for N/A..

    Obviously, I am posting because it does not work. I do not get errors, but I am not getting the correct values either. I could blabber incoherently for a while longer but let me just cut to the chase.....

    Does any one have any suggestions???

    Thanks,
    Brent

  2. #2
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    DCount(i, "[REPORT]", i = 3)

    The i here can't be done like that. DCount is expecting TEXT to define the field and criteria. Try:

    DCount("[" & i & "]", "[REPORT]", "[" & i & "] = 3")
    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

  3. #3
    Join Date
    Jun 2007
    Posts
    74
    Here's to you!


    The Syntax beast bites again. I figured that was it but after fiddling with it for a couple of hours I still could not get it right.

    THANK YOU,
    Brent

  4. #4
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    You're most 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
  •