Results 1 to 3 of 3
  1. #1
    2 Star Lounger
    Join Date
    May 2002
    Location
    Quincy, Illinois
    Posts
    138
    Thanks
    0
    Thanked 0 Times in 0 Posts

    DCount using an SQL (Access 2003)

    Hello,

    According to Microsoft's help, the DCount functions 'domain' must be a Table Name or a Query Name, however I want to use an SQL defined in my code. Is their a way this can be done? If not, what is the most efficient way to count records in an SQL statement without creating a query. I do realize that I could define the SQL as a recordset and do a recordcount, but this is time consuming.

    Thanks in advance for any help!
    Regards,
    Drew

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: DCount using an SQL (Access 2003)

    I'm afraid that you'll have to open a recordset. Why is that more time consuming than using DCount?

  3. #3
    2 Star Lounger
    Join Date
    May 2002
    Location
    Quincy, Illinois
    Posts
    138
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: DCount using an SQL (Access 2003)

    The last test I ran opened a form and populated appoximately 10 captions with the number of records in 10 different tables. Originally I used DCount for this and had no problems. It worked fast with no delay. When trying to make my code more efficient, I used the recordset approach. After that, the form took 3-5 seconds to open (can't remember how many records were in each table...if that matters).

    Thanks for your help. I will try using the recordset approach on this one. May just live with the delay.
    Regards,
    Drew

Posting Permissions

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