Tamzoid
Tamzoid

Reputation: 29

Access VBA - recordset losing position

Option Compare Database Private rs As Recordset

Private Sub Send_Click()
Dim strLocation As String

 If MsgBox("Please confirm you wish to run todays tasks.", vbYesNo) = vbNo Then
    Exit Sub
End If


Set rs = Me.RecordsetClone

rs.MoveFirst
Do Until rs.EOF
Debug.Print rs("title")

    'Call Update_Progress("Test", rs("ID"))

rs.MoveNext
Loop

rs.Close
Set rs = Nothing

End Sub

Hello,

Please see the code above. Can someone advise how I keep the recordset's position when I move between functions/subs.

This code loops through the records fine if I note out the "Update_Progess" Function but when this is in, it continually loops through the first record?

thanks in advance

Upvotes: 1

Views: 174

Answers (1)

Tamzoid
Tamzoid

Reputation: 29

As in the Comments,

I had a requery of the form in one of the Functions which was causing the recordset reset its position, this was fixed by amending to a refresh.

Upvotes: 1

Related Questions