G
Guest
Hi,
I was wondering if there is a more efficient way to scan through
DAO.Recordsets. I typically use RecordCount in a for loop, but before I use
it I need to MoveLast and then MoveFirst. Example:
Dim RS as DAO.Recordset
Dime x as Integer
Set RS = CurrentDb.OpenRecordset("SELECT * FROM [Main Table] WHERE
[ProductType] = '" & MC & "'", dbOpenDynaset, dbSeeChanges)
RS.MoveLast
RS.MoveFirst
For x = 1 To RS.RecordCount
'............
'Go through records.
'............
RS.MoveNext
Next x
Is there anyway I can avoid using MoveLast and MoveFirst?
I tried coming up with using an EACH in the for loop but was not successful.
I was wondering if there is a more efficient way to scan through
DAO.Recordsets. I typically use RecordCount in a for loop, but before I use
it I need to MoveLast and then MoveFirst. Example:
Dim RS as DAO.Recordset
Dime x as Integer
Set RS = CurrentDb.OpenRecordset("SELECT * FROM [Main Table] WHERE
[ProductType] = '" & MC & "'", dbOpenDynaset, dbSeeChanges)
RS.MoveLast
RS.MoveFirst
For x = 1 To RS.RecordCount
'............
'Go through records.
'............
RS.MoveNext
Next x
Is there anyway I can avoid using MoveLast and MoveFirst?
I tried coming up with using an EACH in the for loop but was not successful.