R
robc
Basically this gets stuck on the last row inside the inner loop every time.
Why doesn't the "And Not rs.EOF" work ?
Function PrjOrdSeq()
Dim db As database
Dim rs As Recordset
Set db = CurrentDb()
Set rs = db.openrecordset("qrytblPrjOrdLinHier-SORT")
Dim strCurJob As String
Dim cnt As Long
cntRec = DCount("[Job]", "qrytblPrjOrdLinHier-SORT")
rs.MoveFirst
Do While Not rs.EOF
strCurJob = rs!Job
cnt = 1
Do While rs!Job = strCurJob And Not rs.EOF
rs.Edit
rs!Sequence = cnt
rs.Update
cnt = cnt + 1
rs.MoveNext
Loop
Loop
rs.Close
Set rs = Nothing
db.Close
Set db = Nothing
End Function
Why doesn't the "And Not rs.EOF" work ?
Function PrjOrdSeq()
Dim db As database
Dim rs As Recordset
Set db = CurrentDb()
Set rs = db.openrecordset("qrytblPrjOrdLinHier-SORT")
Dim strCurJob As String
Dim cnt As Long
cntRec = DCount("[Job]", "qrytblPrjOrdLinHier-SORT")
rs.MoveFirst
Do While Not rs.EOF
strCurJob = rs!Job
cnt = 1
Do While rs!Job = strCurJob And Not rs.EOF
rs.Edit
rs!Sequence = cnt
rs.Update
cnt = cnt + 1
rs.MoveNext
Loop
Loop
rs.Close
Set rs = Nothing
db.Close
Set db = Nothing
End Function