Thank you June, the code works.
Maybe this kind of error is very common (no clue). I'll post in case it helps someone. Here's my understanding of it... this code causes a failure later on:
Code:
Private Sub Combo8_AfterUpdate()
' Find the record that matches the control.
With Me.Recordset.Clone
.FindFirst "[ID] = " & Nz(Me![Combo8], 0)
If Not .EOF Then Me.Bookmark = .Bookmark
End With
End Sub
Sure, it works immediately, but while there's nothing wrong with it, I believe "me.bookmark = .bookmark" programmatically changes the record and fires the BeforeUpdate event (bear in mind, the form is still in .edit mode from typing in textboxes for the original, pre-bookmark-changing record):
Code:
Private Sub Form_BeforeUpdate(Cancel As Integer)
If MsgBox("You have made changes. Commit?", vbQuestion + vbYesNo) = vbNo Then
txtStuffName.Value = txtStuffName.OldValue ' The error will fire here, because this line not only makes the visible text undo,
but also attempts to change the value of the record it's linked to... in this case the record you just bookmarked to, which is
not currently in .edit mode. It's exactly the same error (#3020) as if you tried to say recordset![fieldname] = "text" without
first doing a recordset.edit
End If
End Sub
In the context of the problem I'm having, you pointed out that the error only occurs IF the forms record selector has a pencil icon indicating you're in .edit mode already for the original row. Someway somehow this jumbling of both the original row being edited AND programmatic changing of the .bookmark before getting a chance to update the changes causes discord.
You suggested me.undo as an alternative, and this seems to work.
Thank you,
Matt