Recordset in Access doesn't function as expected

M

M Shafaat

Hi,
The following code in VBA for Access functions incorrectly because the
recordset returns wrong number of records, it shows only one record, while
it should be 1500!



I would appreciate if you could explain this behaviour to me.



My VBA code:



Dim rsRoutes As Recordset
dim SQLStr As String



SQLStr = "SELECT DISTINCT RouteNumber FROM Routes ORDER BY RouteNumber"

Set rsRoutes = CurrentDb.OpenRecordset(SQLStr)



For i = 1 To rsRoutes.RecordCount

.. Do something

Next



Regards
M Shafaat
 

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

Similar Threads


Top