Results 1 to 5 of 5
  1. #1
    burnettec is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jan 2013
    Posts
    5

    Question help with query to count different date records in one field

    My database contains a field called "begin date", data type is number, format is yyyymmdd. There are approximately 280,000 records for this field and I want to create a query to count the total number of dates that start with (for example) 2004, 2005, 2006,...2013. The queries I created aren't working for me and I don't know why. This is how I set one of them up: drag "begin date" to query design view column, create a totals row in the query and set it to "count", enter criteria [Like "2004*"], repeat this design within the query for each year I'm interested in counting. When I run the query, no data is returned. Clearly I need more experience with queries! Thanks in advance.

  2. #2
    alansidman's Avatar
    alansidman is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    Apr 2010
    Location
    Steamboat Springs
    Posts
    2,529
    In a new field, type: Year: Left([begin date],4).

    In a new query, using the query you just created with the new field as the record source. Put the Year field in the query grid twice. click on the Sigma in the ribbon. Change the second Group by to Count. Run your query.

  3. #3
    burnettec is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jan 2013
    Posts
    5
    Hi, and thanks for your reply. I'm working on your solution and think I know where you're going with it based on what I did in Excel. Will get back with results asap.

  4. #4
    alansidman's Avatar
    alansidman is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    Apr 2010
    Location
    Steamboat Springs
    Posts
    2,529
    In a query. It is not a good RDBMS policy to do any calculations in tables.

    See attached
    Attached Files Attached Files

  5. #5
    burnettec is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jan 2013
    Posts
    5
    Good advice about not calculating in tables. I have tested your queries and they work great. Thanks very much for your help. Access seems to be a bit more restrictive in its methods than Excel, but very useful for big data sets. Much appreciated.

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

Similar Threads

  1. Count Records by Reject type on Max Date
    By crystal2000a in forum Access
    Replies: 2
    Last Post: 12-04-2012, 05:34 PM
  2. COUNT Group Count Records COUNT FUNCTION
    By PMCOFFEY in forum Access
    Replies: 9
    Last Post: 11-09-2012, 09:40 PM
  3. Count records since date
    By sotssax in forum Queries
    Replies: 10
    Last Post: 03-07-2012, 07:30 PM
  4. Replies: 0
    Last Post: 03-26-2011, 09:59 AM
  5. Query to count records
    By jpkeller55 in forum Access
    Replies: 4
    Last Post: 10-24-2010, 09:24 AM

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