I have code that puts in a date for when the record is last updated:
Private Sub Form_BeforeUpdate(Cancel As Integer)
LastUpdated = Date
End Sub
It works as long as after I make any change I go to a different record using the navigation buttons at the bottom of the form.
However, we have a txtbox in the header that we use to search for records by last name, and if I make a change and then use our search box to go to a new record, I get an error when I use that BeforeUpdate code above. The Error code says "Update or CancelUpdate without Addnew or Edit"
This is the search code that I am using. It is something that I copied off of online so I'm not sure it is the best but it was simple and it works:
With Me.RecordsetClone
.FindNext "[Last Name]=""" & strSearch & """"
If .NoMatch Then
Beep
Else
Me.Bookmark = .Bookmark
End If
End With
With my VERY basic understanding it seems that what is happening is that
1) I make a change
2) Before it updates it changes the Lastupdated field to today's date
3) (Still before updating) I do a search for a new last name and try to go there
4) It doesn't like that because the last record wasn't done updating...
So, any ideas on how to fix this? Is this were I should requery or something like that I assume?
Thanks