[AccessD] Record Set only returning 1 record

David Emerson newsgrps at dalyn.co.nz
Sun May 11 14:05:33 CDT 2008


Access XP

I have the following code in a report:

Option Compare Database
Option Explicit

' Constant for maximum number of columns on report
Const cTotalColumns = 16

' Variables for Recordset.
Dim rstReport As DAO.Recordset

' Variables for number of columns and column totals.
Dim intColumnCount As Integer

Private Sub Report_Open(Cancel As Integer)

     Dim qdf As DAO.QueryDef

     ' Set database variable to current database.
     Set qdf = CurrentDb.QueryDefs("qryBSVRRpt2")

     ' Open Recordset object.
     Set rstReport = qdf.OpenRecordset()

     '  Set a variable to hold number of columns in query.
     intColumnCount = rstReport.RecordCount

End Sub

When I run qryBSVRRpt2 directly it shows 16 records.  However, when I 
put a breakpoint on the line above where intColumnCount is set, it 
only shows 1 record, and my report only processes 1 record.

Does anyone know why the code is only returning 1 record?


Regards

David Emerson
Dalyn Software Ltd
Wellington, New Zealand 




More information about the AccessD mailing list