Results 1 to 3 of 3
  1. #1
    McArthurGDM is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2014
    Posts
    215

    Count of Records in Query

    I need to run a count of the number of records in a Query within my VBA code. Basically,



    if the count of the number of records within a query is 0, then the code runs and if not, the code breaks and the user is left with an error message.

    Problem is, I don't know how to reference the count of a query within VBA.

    Any suggestions?

  2. #2
    amrut is offline Expert
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2012
    Location
    Dubai
    Posts
    614
    You can use DCount function See her for it's usage. http://www.techonthenet.com/access/f...ain/dcount.php
    Use your query name for domain.

  3. #3
    McArthurGDM is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2014
    Posts
    215
    Thank you! I'll give it a shot and see what happens, but it looks like my solution.

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

Similar Threads

  1. Replies: 4
    Last Post: 03-29-2014, 01:29 AM
  2. Replies: 1
    Last Post: 01-24-2013, 05:50 PM
  3. COUNT Group Count Records COUNT FUNCTION
    By PMCOFFEY in forum Access
    Replies: 9
    Last Post: 11-09-2012, 09:40 PM
  4. count the number of records from a query
    By Nixx1401 in forum Queries
    Replies: 4
    Last Post: 05-24-2011, 06:45 PM
  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