looping through access table.
Q: I'm trying to loop through an access table while comparing field value to one another testing if they are in sequence order. If test sequence is is not true then add on to the previouse field value and assign it to a text box. below is the code; Can anyone convey as to why I recieve this error message:Item not found in this collection. (Error 3265)
An attempt to reference a name in a collection failed.
Set rstD = CurrentDb.OpenRecordset("SELECT ACCOUNT FROM [20XXXX1]", dbOpenDynaset)
Set rstD2 = CurrentDb.OpenRecordset("SELECT ACCOUNT FROM [20XXXX1]", dbOpenDynaset)
For i = 0 To rstD.RecordCount + 1
For j = 0 To rstD.RecordCount + 2
If rstD.Fields(j).Value - rstD.Fields(i).Value > 1 Then
ACCOUNT.Value = Val(rstD.Fields(i).Value) + 1
Set rstD = Nothing