Page 2 of 5 FirstFirst 12345 LastLast
Results 16 to 30 of 67
  1. #16
    BRZ-Ryan is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    Nov 2013
    Posts
    187
    Quote Originally Posted by June7 View Post
    Is that a multi-value field? I don't use multi-value fields.
    I'm not sure what the wording is for this, but its a subform with a single combobox. When you select a name, another combobox appears below it allowing you to make another selection. I'd prefer to use a multi-select combobox if possible.

  2. #17
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,919
    Sounds like you are simply seeing multiple rows of a form set for datasheet view. Each selection creates a new record.

    Unless any of these combobox dropdowns shows a checkbox next to each item in the list, you are seeing normal data entry control.

    Should get a thorough understanding of multi-value field before deciding to use. I refuse to use.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #18
    BRZ-Ryan is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    Nov 2013
    Posts
    187
    Quote Originally Posted by June7 View Post
    Sounds like you are simply seeing multiple rows of a form set for datasheet view. Each selection creates a new record.

    Unless any of these combobox dropdowns shows a checkbox next to each item in the list, you are seeing normal data entry control.

    Should get a thorough understanding of multi-value field before deciding to use. I refuse to use.
    I have the query from above working now so I am happy. This report is ran once a month, and the most attendees we will ever possibly have is less than 50. I am not experienced enough to properly 'normalize' the tables.

    Just a question for you..

    (People table is actually named Security, and Role is Access)

    In your query, you had Security.ID in Count(), does it matter what is in here? I works when I replace it with another field from the table (Since ID does not exist). Do you see anything not proper with this? It works perfectly.
    Code:
    SELECT Name, Count(Security.Name) AS Events
    FROM (SELECT Events.ID, Name, Attendees, Access
    FROM Events, Security
    WHERE (InStr([Attendees],[Name])>0) AND (Access="Attendee") AND (EventDate >= Date())) AS Q1
    GROUP BY Name;
    This also works, but it shows all people (even with 0 events)
    Code:
    SELECT Security.Name, Security.Access, DCount("[CompanyName]","[Events]","Instr([Attendees],'" & [Name] & "')>0") AS AttendanceCount
    FROM Security
    WHERE (((Security.Access)="Attendee"));

  4. #19
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,919
    Count(*) should work just as well.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #20
    BRZ-Ryan is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    Nov 2013
    Posts
    187
    Here's the final one I think I'll go with, I added order by. Is it OK to ORDER BY Count(*)? Also, what does the Q1 represent? I see the first "As Events" results in the Column heading being labeled 'Events'

    Code:
    SELECT Name, Count(*) AS Events
    FROM (SELECT Attendees, Name, Access
    FROM Events, Security
    WHERE (InStr([Attendees],[Name])>0) AND (Access="Attendee") AND (EventDate >= Date())) AS Q1
    GROUP BY Name
    ORDER BY Count(*) Desc, Name;

  6. #21
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,919
    So it worked?

    Q1 is an alias name for the inner nested query. It can be whatever you want.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  7. #22
    BRZ-Ryan is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    Nov 2013
    Posts
    187
    Quote Originally Posted by June7 View Post
    So it worked?

    Q1 is an alias name for the inner nested query. It can be whatever you want.
    Yes, and thank you for all of your help. Is there any way to list people with 0's if they have no events with the query from my previous post?

  8. #23
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,919
    That requires a query that joins the Count query with a master dataset of all people, join type "Include all records from People ..."
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  9. #24
    BRZ-Ryan is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    Nov 2013
    Posts
    187
    What is a master dataset of people? Would this be my 'people' table? Your query runs a lot faster than the one that uses DCount so I prefer to use yours but I need it to show 0's. Also, I need to add a column for how many 'Monday' events each person has in the report, DatePart('weekday',[EventDate])=2?

  10. #25
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,919
    Yes, probably your 'people' table.

    For the Monday count, try:

    SELECT Name, Count(*) AS Events, Sum(IIf(Weekday([EventDate])=2,1,0)) AS CountMon
    FROM (SELECT Attendees, Name, Access
    FROM Events, Security
    WHERE (InStr([Attendees],[Name])>0) AND (Access="Attendee") AND (EventDate >= Date())) AS Q1
    GROUP BY Name
    ORDER BY Count(*) Desc, Name;
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  11. #26
    BRZ-Ryan is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    Nov 2013
    Posts
    187
    It's prompting me for EventDate (this field is in Events)

  12. #27
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,919
    SELECT Name, Count(*) AS Events, Sum(Mon) AS CountMon
    FROM (SELECT Attendees, Name, Access, IIf(Weekday([EventDate])=2,1,0)) AS Mon
    FROM Events, Security
    WHERE (InStr([Attendees],[Name])>0) AND (Access="Attendee") AND (EventDate >= Date())) AS Q1
    GROUP BY Name
    ORDER BY Count(*) Desc, Name;
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  13. #28
    BRZ-Ryan is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    Nov 2013
    Posts
    187
    Works great! thanks, is it possible to show 0's for the people with no events?

  14. #29
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,919
    Now join that query to the 'all people' table, join type 'Include all records from 'all people' ...

    Really should use unique ID instead of Name in the grouping query then join to people table by joining on ID.

    Also, Name is a reserved word and should not use reserved words as names.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  15. #30
    BRZ-Ryan is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    Nov 2013
    Posts
    187
    What do you mean by join the query?

    I have added an ID field to people table, I also want to make an attendance table to record who goes to what event, instead of storing people as a string in the events table. What do you think is a good layout for this table that will be easy for reporting?
    [ID][Event#][AttendeeID#]?

Page 2 of 5 FirstFirst 12345 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 2
    Last Post: 11-27-2013, 05:24 PM
  2. Replies: 9
    Last Post: 05-08-2013, 02:37 PM
  3. Replies: 1
    Last Post: 06-08-2012, 11:14 AM
  4. combo box query based on different query result?
    By mejia.j88 in forum Queries
    Replies: 10
    Last Post: 02-15-2012, 02:00 PM
  5. Query result based upon two field conditions
    By diane802 in forum Access
    Replies: 35
    Last Post: 01-08-2010, 06:31 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