jkfeagle
Codus Confusious
- Local time
- Yesterday, 20:18
- Joined
- Aug 22, 2002
- Messages
- 166
I am running some code that searches one data set looking for matches in another. The code works fine until it finds a match that involves the last data entry in one of the data sets and then it seems to get caught in a loop at that entry. Here is the code:
Set rstCheckInfo = CurrentDb.OpenRecordset("tblAfterSisMods")
With rstCheckInfo
rstCheckInfo.MoveFirst
Do While Not .EOF
Set rstCBSisters = CurrentDb.OpenRecordset("tblCB_SISTERS")
With rstCBSisters
rstCBSisters.MoveFirst
Do Until .EOF
If rstCBSisters("CB #") = rstCheckInfo("PdPCB") Then
varBigSister = rstCBSisters("ID")
rstCheckInfo.Edit
rstCheckInfo("CBLink") = varBigSister
rstCheckInfo.Update
rstCBSisters.MoveLast
Else
rstCBSisters.MoveNext
End If
Loop
End With
rstCheckInfo.MoveNext
Loop
End With
I have verified where it gets caught in the loop and as I said it is when the last record in rstCBSisters is the match to the record in rstCheckInfo. I suspect that it is somehow getting hung on the .EOF issue but I can't figure it out. Any ideas??
Set rstCheckInfo = CurrentDb.OpenRecordset("tblAfterSisMods")
With rstCheckInfo
rstCheckInfo.MoveFirst
Do While Not .EOF
Set rstCBSisters = CurrentDb.OpenRecordset("tblCB_SISTERS")
With rstCBSisters
rstCBSisters.MoveFirst
Do Until .EOF
If rstCBSisters("CB #") = rstCheckInfo("PdPCB") Then
varBigSister = rstCBSisters("ID")
rstCheckInfo.Edit
rstCheckInfo("CBLink") = varBigSister
rstCheckInfo.Update
rstCBSisters.MoveLast
Else
rstCBSisters.MoveNext
End If
Loop
End With
rstCheckInfo.MoveNext
Loop
End With
I have verified where it gets caught in the loop and as I said it is when the last record in rstCBSisters is the match to the record in rstCheckInfo. I suspect that it is somehow getting hung on the .EOF issue but I can't figure it out. Any ideas??