I have a Single Form(frmSequenceTemplates) that contains a Continuous Sub-Form(frmSelect). I have a series of fields in frmSelect(one in particular called templateVersion and another called templateComment). In Sub, I have an event procedure that is called on the "After Update" command that I would like to retrieve a comment and update the current record in the continuous form. See the code below:
This seems to work fine if the record is being updated for the first time(i.e. null turns into "test comment") OR if the records comment has changed(i.e. "test comment" turns into "test comment 1").
Where I am having trouble is if the comment matches exactly what it was before(i.e. "test comment" turns into "test comment"). In this case the system is giving me a Write Conflict error: "This record has been changed by another user since you started editing it. If you save the record, you will overwrite the changes the other user made. Copying the changes to the clipboard will let you look at the values the other user entered, and then paste your changes back in if you decide to make changes."
Any ideas on why this is happening and how I can fix it would be appreciated. The desired result would be the system overwriting the comment field every time.
Thanks in advance for your help!
Code:
Dim WineType As String
Dim Version As Integer
Dim site As Integer
Dim year As Integer
Dim Comment As String
Dim sql As String
Dim update As String
WineType = [Forms]![frmSequenceTemplates]![frmSelect]![tmplt_wn_typ_i]
Version = [Forms]![frmSequenceTemplates]![frmSelect]![ver_n]
site = [Forms]![frmSequenceTemplates]![site]
year = [Forms]![frmSequenceTemplates]![year]
Set db = CurrentDb()
sql = "SELECT cmnt_e FROM wmgtp03_wp_tmplt_hdr WHERE tmplt_i = '" & WineType & "' AND ver_n = " & Version & " AND site_sys_I = " & site & " AND yr_n = " & year
Set rs = db.OpenRecordset(sql)
rs.MoveFirst
Comment = rs.Fields(0)
If (Comment = Me.templateComment) Then
Else
Me.templateComment = Comment
End If
This seems to work fine if the record is being updated for the first time(i.e. null turns into "test comment") OR if the records comment has changed(i.e. "test comment" turns into "test comment 1").
Where I am having trouble is if the comment matches exactly what it was before(i.e. "test comment" turns into "test comment"). In this case the system is giving me a Write Conflict error: "This record has been changed by another user since you started editing it. If you save the record, you will overwrite the changes the other user made. Copying the changes to the clipboard will let you look at the values the other user entered, and then paste your changes back in if you decide to make changes."

Any ideas on why this is happening and how I can fix it would be appreciated. The desired result would be the system overwriting the comment field every time.
Thanks in advance for your help!