L
Lee
Hi everyone,
Can you tell me what I should do to stop a runtime error
when the procedure gets to the end of file (EOF) - I get
error 3021 "No current record". Here's the code:
varCentre = txtCentre
intCounter = 0
With Forms!Main.Sub.Form.RecordsetClone
.FindFirst "CentreNo=" & varCentre
If .NoMatch Then
MsgBox "blah, blah..."
End If
Forms!Main.Sub.Form.Bookmark = .Bookmark
If Not .EOF Then
Do While intCounter < 6
intCounter = intCounter + 1
If Not .EOF Then
.MoveNext
'STOPS HERE > Forms!Main.Sub.Form.Bookmark = .Bookmark
ElseIf .EOF Then
.MovePrevious
Forms!Main.Sub.Form.Bookmark = .Bookmark
Exit Do
End If
Loop
End If
End With
Any help would be greatly appreciated!
Many thanks,
Lee
Can you tell me what I should do to stop a runtime error
when the procedure gets to the end of file (EOF) - I get
error 3021 "No current record". Here's the code:
varCentre = txtCentre
intCounter = 0
With Forms!Main.Sub.Form.RecordsetClone
.FindFirst "CentreNo=" & varCentre
If .NoMatch Then
MsgBox "blah, blah..."
End If
Forms!Main.Sub.Form.Bookmark = .Bookmark
If Not .EOF Then
Do While intCounter < 6
intCounter = intCounter + 1
If Not .EOF Then
.MoveNext
'STOPS HERE > Forms!Main.Sub.Form.Bookmark = .Bookmark
ElseIf .EOF Then
.MovePrevious
Forms!Main.Sub.Form.Bookmark = .Bookmark
Exit Do
End If
Loop
End If
End With
Any help would be greatly appreciated!
Many thanks,
Lee