ClaraBarton
Registered User.
- Local time
- Yesterday, 19:19
- Joined
- Oct 14, 2019
- Messages
- 605
I've debugged and debugged and NextPK always returns the same record as IntID
I feel like I'm missing something very obvious and will feel like an idiot...
I feel like I'm missing something very obvious and will feel like an idiot...
Code:
20 Me.Filter = ""
30 Me.FilterOn = False
40 Set rst = Me.RecordsetClone
50 intID = Me.recipeid
'get the PK of the next record
60 With rst
70 If Not .EOF Then
80 .Move 1
90 NextPK = Me.recipeid
100 .Move -1
'or the previous one
110 Else: .Move -1
120 NextPK = Me.recipeid
130 .Move 1
140 End If
150 End With
180 varResponse = MsgBox("Are you sure you want to delete " & vbLf & _
"this recipe? " & vbCr, _
vbOKCancel, "Deleting Recipe")
190 If varResponse = vbOK Then
200 strSQL = "DELETE * FROM [t_Recipe] WHERE RecipeID = " & intID
210 CurrentDb.Execute strSQL, dbFailOnError
220 Me.Requery
230 rst.FindFirst "[RecipeID]=" & NextPK
240 rst.Close
Last edited: