Results 1 to 4 of 4
  1. #1
    Join Date
    Apr 2003
    Posts
    280

    Unanswered: How do I do an recordcount for an Access query

    this is my code.

    Dim conndb as ADODB.Connection
    Dim rsTransInfo as ADODB.Connection


    Set conndb = CurrentProject.Connection
    Set rsTransInfo = New ADODB.Recordset

    rsTransInfo.Open "[qryGet TransactionInfo]", conndb

    Msgbox " " & rsTransInfo.RecordCount & ""

    I would get an "Operation is not allowed when the object is closed." What do this mean?

  2. #2
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    I think you need to use the movelast command on your recordset before the recordcount contains a valid value.

    blindman

  3. #3
    Join Date
    May 2002
    Location
    London
    Posts
    87
    You should check for EOF (No records returned) before you do a MoveLast

    Code:
    If Not rsTransInfo.EOF Then
        rsTransInfo.MoveLast
    End If
    Msgbox " " & rsTransInfo.RecordCount & ""

  4. #4
    Join Date
    Apr 2003
    Posts
    280
    Thanks y'all it works!

Posting Permissions

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