trouble with recordsets

dreamdelerium

Registered User.
Local time
Yesterday, 23:15
Joined
Aug 24, 2007
Messages
88
hey everyone. can anyone look at my code and tell me what im doing wrong? im trying to open up a recordset with all rows from a table but when i do, it just has the first row. i know the sql string is correct because when i run it in the querry builder, it has all rows

Code:
Option Compare Database
Private Sub Report_Open(Cancel As Integer)
On Error GoTo errorhandler
Dim SelectStrings As String
Dim MyRecordSets As Recordset
Dim QuestionArrays As Variant
Dim Counters As Integer

SelectStrings = "Select * From tblQuestionResults"
Set MyRecordSets = CurrentDb.OpenRecordset(SelectStrings)
 
If Not MyRecordSets.EOF Then QuestionArrays = MyRecordSets.GetRows(MyRecordSets.RecordCount)
Counter = MyRecordSets.RecordCount
MsgBox (Counter)
MyRecordSets.Close
 

errorhandler:
If Err.Number = 0 Then
Else
MsgBox (Err.Description)
End If
End Sub
 
Simple Software Solutions

Using this methodology once you have opened the recordset the pointer is still at the BOF you have too send a Rs.MoveLast command in order for it to establish the total number of records in the recordset.

This is different when using ADODB. Also it works better with DAO.

CodeMaster::cool:
 

Users who are viewing this thread

Back
Top Bottom