Results 1 to 4 of 4
  1. #1
    samirmehta19 is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    May 2013
    Posts
    3

    Count of specific number


    Hello, I am very new with access and I am struggling how to get a specific task done. My table has automatic ID in one column which is unique in each data entry row. There is another column which has "Batch Id" which might be repeated in some of the rows but most of the time it is unique value. I would like to get get an updated count of this "Batch id" from start to the point of entry of new entry to understand how many total batch ids entered to that point. I am open to do this in table if possible of by creating new query. Can someone help me.

  2. #2
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    Create a query based on your table.

    Add the BatchID
    put in a criteria for the batch of >[Enter the Batch ID]
    (this will find any batch ID greater than whatever you specify when you run the query)

    Click the SIGMA button on your toolbar (looks like a capital E)
    An additional row will be added to your query that is labeled TOTAL

    Create another column that says BatchCount: batchID
    in the TOTAL line put COUNT


    The query will show you the batchID and how many instances of that batch ID exist in your table starting with the batchID you specify.

  3. #3
    samirmehta19 is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    May 2013
    Posts
    3
    Hello,
    Thank you for your help. This works but partially. Actually I want to count only unique values of Batch Id and this gives me total of all batch id including duplicates. How can I do this?

    Thank you in advnace.

    Quote Originally Posted by rpeare View Post
    Create a query based on your table.

    Add the BatchID
    put in a criteria for the batch of >[Enter the Batch ID]
    (this will find any batch ID greater than whatever you specify when you run the query)

    Click the SIGMA button on your toolbar (looks like a capital E)
    An additional row will be added to your query that is labeled TOTAL

    Create another column that says BatchCount: batchID
    in the TOTAL line put COUNT


    The query will show you the batchID and how many instances of that batch ID exist in your table starting with the batchID you specify.

  4. #4
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    Ah so if you have

    Code:
    Batch_ID
    11
    11
    11
    23
    23
    34
    34
    34
    34
    34
    34
    You only want to show 3 because there are three unique batch numbers

    To do that you'd have to run a summation query on just the batch_ID field which would give you this:

    [code]
    11
    23
    34
    [code]

    then you can either use a dcount function or another query that counts the values of this 'sub' query

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

Similar Threads

  1. Replies: 1
    Last Post: 04-04-2013, 11:59 AM
  2. Replies: 1
    Last Post: 01-24-2013, 05:50 PM
  3. Replies: 6
    Last Post: 07-25-2011, 01:54 PM
  4. Dividing time by a specific number
    By harrig04 in forum Queries
    Replies: 1
    Last Post: 07-05-2011, 09:09 AM
  5. Count of field based on specific values
    By tazzmann67 in forum Access
    Replies: 2
    Last Post: 03-30-2011, 09:11 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