Results 1 to 5 of 5

Thread: Get Access table record count using criteria

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 2002
    Posts
    382

    Get Access table record count using criteria

    Need some help please. Running Excel VBA, I want to get the number of records in an Access table where the records have a certain value in a field and return that count to Excel. Thanks for any help.

  2. #2
    PowerPoster RhinoBull's Avatar
    Join Date
    Mar 2004
    Location
    New Amsterdam
    Posts
    24,132

    Re: Get Access table record count using criteria

    Open ado recordset using sql similar to this:

    "select count(*) from myTable where myField like '%abc%'"

    That should include all records where myField value contain "abc":

    khwabclskjdhjsh
    abcjdshds
    lkjhwgabc

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 2002
    Posts
    382

    Re: Get Access table record count using criteria

    Thanks, but how do I get (display, store) the count itself?

  4. #4
    PowerPoster RhinoBull's Avatar
    Join Date
    Mar 2004
    Location
    New Amsterdam
    Posts
    24,132

    Re: Get Access table record count using criteria

    You're not providing enough details for your request so I'm not sure what you mean here...
    However, it sounds like you need to add Group By clause to your sql as well. Search our FAQ or db forums or the internet for Group By - you should get plenty of info to get started.

  5. #5

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width