Results 1 to 3 of 3
  1. #1
    spmiyamoto is offline Novice
    Windows 10 Office 365
    Join Date
    Jan 2023
    Posts
    2

    Help Request - Summerizing record counts

    I could use some help resolving an issue I'm having. The query needs to summerize the number of visits for a given ClientNumber over a specified date range. The results would need to be:
    Click image for larger version. 

Name:	query-sql.png 
Views:	11 
Size:	6.2 KB 
ID:	50126
    ClientNumber NumberOfVisits
    1001 2
    1005 1
    1009 2
    etc.

    Thanks,
    Steve
    Attached Thumbnails Attached Thumbnails query-example.png  

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Please provide data as tables built in post (Advanced editor) or attach file. Also, post code as text between CODE tags. Images are not appreciated as cannot copy/paste.

    You want an aggregate query. Access has a wizard for that. In query design view click Sigma (Totals) icon on ribbon.

    Need to deal with time portion of value. Consider something like:
    Code:
    SELECT ClientNumber, Count(*) As CntVisits FROM ClientVisits WHERE DateValue(DateOfVisit) BETWEEN [enter start date] AND [enter end date] GROUP BY ClientNumber ORDER BY ClientNumber;
    Instead of aggregate query, could build a report and use its Sorting & Grouping features with aggregate calcs. This allows display of detail data as well as summary info.
    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. #3
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,940
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

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

Similar Threads

  1. Replies: 15
    Last Post: 07-29-2021, 03:33 AM
  2. A simple "find record" request... I think
    By cvansickle in forum Forms
    Replies: 4
    Last Post: 02-13-2019, 05:33 PM
  3. Replies: 2
    Last Post: 01-25-2016, 12:21 AM
  4. Replies: 5
    Last Post: 09-29-2015, 11:08 AM
  5. too many counts!
    By Svear in forum Access
    Replies: 1
    Last Post: 03-07-2012, 10:14 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