Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2004
    Location
    Globalized
    Posts
    14

    Question Unanswered: [Caution Newbie] problem with RecordCount

    Why is the below code not returning the record count?

    -------
    Dim rst As ADODB.Recordset
    Set rst = New ADODB.Recordset

    rst.Open "payment_due", CurrentProject.Connection
    Debug.Print rst.RecordCount
    --------

    All I get is -1

    BTW the payment_due is a query set up in Access.

    Where am I going wrong here?

    Thanks!

  2. #2
    Join Date
    Oct 2001
    Location
    Chicago
    Posts
    440
    Dim rst As ADODB.Recordset
    Set rst = New ADODB.Recordset

    rst.Open "payment_due", CurrentProject.Connection, adOpenStatic
    rst.MoveLast
    rst.MoveFirst

    Debug.Print rst.RecordCount

    -the cursor type must support the RecordCount property
    -move throught the recordset to get the correct count

    Matt

  3. #3
    Join Date
    Jan 2004
    Location
    Globalized
    Posts
    14

    Wink SOLVED! Thanks, Matt!

    I knew it was something simple

Posting Permissions

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