Results 1 to 8 of 8
  1. #1
    missypooh1969 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Aug 2014
    Posts
    15

    Adding date field ignores count fields?


    I have a query that contains a few different count fields. I am trying to set up a parameter where the user will enter a [start date] and[end date] to see the same counts. Here's what the query looks like now:

    Company_Name
    Total Of Surveys
    A1
    A2
    A3
    A4
    A5
    Satisfaction_Rating
    Water Company
    2
    0
    0
    1
    0
    1
    100.00%
    Employee Comp
    1
    0
    0
    0
    0
    1
    100.00%
    Aqua Motel
    59
    0
    0
    21
    8
    30
    100.00%
    Need break
    1
    0
    0
    0
    0
    1
    100.00%

    Now when I enter the date field even as a hidden field, I getthis (the dates individual counts, when I need the total count for the timeperiod) I have tried the where clause but it doesn’t seem to do anything:

    Company_Name
    Total Of Surveys
    A1
    A2
    A3
    A4
    A5
    Satisfaction_Rating
    Water Company
    1
    1
    100.00%
    Water Company
    1
    1
    100.00%
    Employee Comp
    1
    1
    100.00%
    Aqua Motel
    1
    1
    100.00%
    Aqua Motel
    1
    1
    100.00%
    Aqua Motel
    1
    1
    100.00%

    And ideas?I have alsotried starting from scratch, adding the date, with the same result.I have come across this before, but I do notremember how I handled it.I wouldrather stay away from reports, as I will be exporting the query results weekly,monthly, quarterly and yearly.
    Thanks in advance!

  2. #2
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    Perhaps you can start by creating a separate query that only performs the count and then include that query as a subquery. In order to count records, you only want to include fields/columns that are unique to what you are counting. Adding additional columns to your query may produce counts that are not desired.

  3. #3
    missypooh1969 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Aug 2014
    Posts
    15
    The first screen shot is the first query. The second screen shot is actually a second query, using the first query's counts (supposed to be). I tried going the other way, had the dates in the first query, then made a second query to use those with the calculations. Both turned out the same. Then I tried making two queries, one with dates, one with calculations, then a third to pull the data together, still same result.

  4. #4
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    How I do it, is to create a query where its sole responsibility is to count (perform the aggregate function). Do you get the correct count when you only add the date field, a query with one column?

    Add or remove columns to get the desired count.

  5. #5
    missypooh1969 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Aug 2014
    Posts
    15
    I have a query that has the exact solutions that I need. When I add the date to the query, it breaks those solutions up "by date". Take the date out, back to the solutions I need, but no way of narrowing it to the dates I need. Use two queries, one with the solutions, one with the dates, combine them, same result. I do not want to see a breakdown of every single day. I want to see the counts for a period of time set by user parameters. Instead of seeing, July 1, July 2, July 3 and on, with the counts for those specific days, I need to see July 1, 2014 - July 31, 2014 and the overall counts for that time period.

  6. #6
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    Do you get the correct count when you create a query with only the date field, a query with one column? Add or remove columns to get the desired count. Then, worry about all of the other stuff.

  7. #7
    missypooh1969 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Aug 2014
    Posts
    15
    The counts are correct. When I add the date either by combining two queries and using one query I come up with this:

    Company_Name Surveydate Total Of Surveys 5 4 3 2
    Water 7/22/2014 1 1
    Water 7/22/2014 1 1
    Water 7/22/2014 1 1
    Aqua 7/7/2014 1 1
    Aqua 7/8/2014 1 1
    Aqua 7/14/2014 1 1
    Aqua 7/14/2014 1 1
    Aqua 7/14/2014 1 1
    Aqua 7/14/2014 1 1
    Aqua 7/14/2014 1 1
    Aqua 7/14/2014 1 1
    Aqua 7/15/2014 1 1

    I want to see this: (which would have parameter [start date] and [end date] (07/01/2014, 07/31/2014)
    Company_Name Total Of Surveys 5 4 3 2 1
    Water 3 2 1
    Aqua 9 5 1 3

  8. #8
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    Create a query with these fields... This will be your subquery
    Company_Name Surveydate Total Of Surveys



    THEN

    Create another query with
    Company Name 5 4 3 2

    While in design view of your second query, add the subquery that you created previously (the query with the count). JOIN on Company_Name.

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

Similar Threads

  1. Replies: 6
    Last Post: 02-13-2014, 11:10 PM
  2. Adding the day of the week to a date field
    By cschieff in forum Reports
    Replies: 2
    Last Post: 10-24-2012, 02:47 PM
  3. not count date fields if the same
    By Icky_Joe in forum Queries
    Replies: 2
    Last Post: 04-11-2012, 12:55 PM
  4. Replies: 1
    Last Post: 02-25-2011, 06:11 PM
  5. Replies: 10
    Last Post: 04-21-2010, 01:16 PM

Tags for this Thread

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