.mdb & recordset & getrows

T

ToniS

I have the following code and was having problems returning all of the
records out of the table. I was only getting the first record. I finall
changed the line 'vardata = rsTblPO.GetRows()' to to 'vardata =
rstblPO.GetRows(5)' and was finally able to get 4 of the records. The help
within VBA states if a value is passed in GetRows, it will return all of the
rows. I have no idea how many rows will be in the table. What is the best
way to set the recordset with all of the data?

Below is what I have

Dim iRowCount As Variant
Dim rsTblPO As DAO.Recordset
Dim vardata As Variant

strSQL = "SELECT tbl_po.[store#], tbl_po.Amount, tbl_po.[Page#] FROM
tbl_PO ORDER BY tbl_po.[Store#]"

Set rsTblPO = CurrentDb.OpenRecordset(strSQL, dbOpenDynaset)
' vardata = rsTblPO.GetRows() ' why cant I get all of the rows?

vardata = rsTblPO.GetRows(5)

iRowCount = UBound(vardata, 2)
 
D

DaveT

.........
rIN.MoveLast
mLngRecs = rIN.RecordCount
rIN.MoveFirst
arySource = rIN.GetRows(mLngRecs)

Dave Thompson
Allen, TX
US
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top