Link to home
Start Free TrialLog in
Avatar of Carlos Fernandez
Carlos FernandezFlag for Mexico

asked on

DAO method only "pulls" first record from the recordset

I have no problem when I send data from a recordset to an array using recordset.GetRows method in ADO, my problem comes when I try to make the same with DAO, the GetRows property only "pulls" the first record from the recordset, and I want to pull all the records from the recordset without using a loop.

I have tried the following with no success:
recordset.GetRows()

Open in new window


and

recordset.GetRows(.RecordCount)

Open in new window


Any guess?
SOLUTION
Avatar of Daniel Pineault
Daniel Pineault

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Something is maybe wrong with your Source because this works
Public Function f()
Dim rst As DAO.Recordset
Dim ar() As Variant
Set rst = CurrentDb.OpenRecordset("NameOfTable")
With rst
.MoveLast
.MoveFirst
ar = rst.GetRows(.RecordCount)
End With
rst.Close
Set rst = Nothing
End Function

Open in new window

ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Carlos Fernandez

ASKER

Thanks Daniel and John, it worked, very crazy that it's needed in DAO method.
@Carlos better to split the points equally...Daniel wrote first about the culprit while i was writing and testing code