David Emerson
newsgrps at dalyn.co.nz
Sun May 11 14:58:54 CDT 2008
Thanks Gustav, That solved it. David At 12/05/2008, you wrote: >Hi David > >Have you tried to call a: > > rstReport.MoveLast > >before counting records? > >/gustav > > >>> newsgrps at dalyn.co.nz 11-05-2008 21:05 >>> >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 > > > >-- >AccessD mailing list >AccessD at databaseadvisors.com >http://databaseadvisors.com/mailman/listinfo/accessd >Website: http://www.databaseadvisors.com