Results 1 to 10 of 10
  1. #1
    SammyConfirmed is offline Novice
    Windows 10 Access 2010 64bit
    Join Date
    Apr 2018
    Posts
    9

    Please help with this query ASAP


    Click image for larger version. 

Name:	lol.PNG 
Views:	8 
Size:	19.6 KB 
ID:	33809Click image for larger version. 

Name:	loll.PNG 
Views:	8 
Size:	18.7 KB 
ID:	33810 Need to create this query

  2. #2
    Micron is offline Very Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,421
    change workoutname from group by to count; change 3 or 4 or 5 to >3 (what you have in the query doesn't match what your posted text says. You might have to change Date from group by to "expression" Date is a bad name for a field. See http://allenbrowne.com/AppIssueBadWord.html
    I've never seen Like with wildcards for date values. Maybe use Datepart or Year function, but I'd change the date field name first.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  3. #3
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,927
    dates are stored as numbers, not text. Your like criteria may work but the usual way would be to use the year function

    year(Date)=2017

    Also note that Date is a reserved word - it means today so using it as a field name can cause problems since sql won't know whether you are using Date the function or Date the field (although square brackets he to differentiate). Recommend changing it to something more meaningful such as workoutDate or classDate

    not sure what you need help with for the workout name column - just change the group by to count

  4. #4
    SammyConfirmed is offline Novice
    Windows 10 Access 2010 64bit
    Join Date
    Apr 2018
    Posts
    9
    Click image for larger version. 

Name:	loll.PNG 
Views:	9 
Size:	22.4 KB 
ID:	33813It says 1 for the count, which is wrong. It must count all unique values (all types of workoutnames) and display the number of how many times each workout has been performed.

  5. #5
    isladogs's Avatar
    isladogs is offline Access MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    6,204
    If you want the total count of each type of workout, remove the date column.
    Otherwise it will tell you how many of each type occurred on each date which seems to be one in all cases.
    Colin Riddington, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I know I don't know, I keep quiet!

  6. #6
    SammyConfirmed is offline Novice
    Windows 10 Access 2010 64bit
    Join Date
    Apr 2018
    Posts
    9
    Click image for larger version. 

Name:	loll.PNG 
Views:	8 
Size:	3.9 KB 
ID:	33814Yeah it works like that, but the query requires me to only list those workouts which have been done in 2017. What do I do to get that? Thanks btw!

  7. #7
    Micron is offline Very Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,421
    If you want the total count of each type of workout, remove the date column.
    That is why I suggested removing the grouping in favour of "expression". Not that I'm guaranteeing it would produce the desired result if done so, but I could see it would not without trying at least.

    Or if it's needed for criteria, don't remove it - uncheck it.

  8. #8
    SammyConfirmed is offline Novice
    Windows 10 Access 2010 64bit
    Join Date
    Apr 2018
    Posts
    9
    Quote Originally Posted by Micron View Post
    That is why I suggested removing the grouping in favour of "expression". Not that I'm guaranteeing it would produce the desired result if done so, but I could see it would not without trying at least.

    Or if it's needed for criteria, don't remove it - uncheck it.
    Doesn't help.

  9. #9
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,927
    just realised I have been looking at this wrong

    you group by workout name

    you count class ID

    you change the date field from group by to where

    you change the workoutdifficulty from group by to where

    if you want the count to be split by difficulty, add workout difficulty a second time and group be that

  10. #10
    SammyConfirmed is offline Novice
    Windows 10 Access 2010 64bit
    Join Date
    Apr 2018
    Posts
    9
    Quote Originally Posted by Ajax View Post
    just realised I have been looking at this wrong

    you group by workout name

    you count class ID

    you change the date field from group by to where

    you change the workoutdifficulty from group by to where

    if you want the count to be split by difficulty, add workout difficulty a second time and group be that
    It worked!!! Thanks!!

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

Similar Threads

  1. Search Filter Databse HELP ASAP
    By JordanS98 in forum Access
    Replies: 2
    Last Post: 06-03-2014, 01:52 AM
  2. [Need Help ASAP] Form VBA Code
    By endlessd in forum Access
    Replies: 5
    Last Post: 03-27-2011, 11:46 AM
  3. Replies: 1
    Last Post: 10-24-2010, 07:42 PM
  4. Help me asap... I need this for my exam
    By freelance_jhoe26 in forum Access
    Replies: 1
    Last Post: 04-20-2009, 02:30 PM
  5. Query help needed asap!!
    By msaccess09 in forum Queries
    Replies: 1
    Last Post: 02-25-2009, 09:39 PM

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