Results 1 to 3 of 3

Thread: Counting records of certain types with DAO

  1. #1

    Thread Starter
    Member
    Join Date
    Jun 2008
    Location
    Milton Keynes, UK
    Posts
    49

    Counting records of certain types with DAO

    Iv been trying to find a way to count records that match a certain criteria, iv been usimg loops which are very slow for large record sets.... is there a cammand that can help me do this? this is the code i use to connect to teh database.

    Code:
    Public dbEmc As Database
    Public rsEmc As Recordset
    
    Set dbEmc = OpenDatabase("DB\EMC.mdb")
    I can add and update records using .addnew and .edit/.update are there any other commands i can use? If there are any tutorials you can think of which may be releven i woul dbe greatful.

    Kind Regards

    PsYiOn

  2. #2
    Addicted Member
    Join Date
    Aug 2007
    Location
    India
    Posts
    141

    Re: Counting records of certain types with DAO

    Are you sure your want to count records in a table.

    In that case use following code

    vb Code:
    1. Dim x As Database
    2. Dim y As Recordset
    3. Set x = OpenDatabase("C:\tst.mdb")
    4. MSgbox "total records count is" & x.TableDefs("tableName").RecordCount
    Do Good. Be Good. The World is yours.

  3. #3
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Counting records of certain types with DAO

    Use the SQL COUNT - it is very easy. Check our Database FAQ section.

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