Results 1 to 11 of 11

Thread: [RESOLVED] counting records

Threaded View

  1. #6

    Thread Starter
    Junior Member macmatira's Avatar
    Join Date
    Mar 2010
    Posts
    21

    Re: counting records

    Quote Originally Posted by RhinoBull View Post
    There are couple of reasons:

    1. You need to set recordset CursorLocation to client first.
    Code:
    Dim RST As ADODB.Recordset
    
        Set RST = New ADODB.Recordset
        rst.CursorLocation = adUseClient
    2. Not every data provider supports the record count.
    i got a trouble.

    pls help me again.

    here is the code i've entered.

    Code:
    Private Sub Command1_Click()
    Set rec = New ADODB.Recordset
    rec.CursorLocation = adUseClient
    
    'to see how many records in the table
    Text1.Text = rec.CursorLocation
    
    MSFlexGrid1.TextMatrix(1, 0) = rec.Fields(0)
    
    End Sub
    then the attachment is the screen shot of the error.
    the error is in the rec.fields (0) and said that:
    Item cannot be found in the collection corresponding to the requested name or ordinal.
    Attached Images Attached Images  
    Last edited by macmatira; May 17th, 2011 at 01:15 PM. Reason: additional information. (ellaboration)

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