I have a form with some Note fields on it.
I needed to track changes every time any of the note fields changed.
I got that part to work and I put it in the Before_Update even as I'm using Note1.Oldvalue as well as Note1.Value for my changes.
The problem that I'm having with this code is that when I come back to this form and want to change Note1, it says that Access has encountered an error while saving the record and can't save.
When I take the Before_Update code out I can make my Note1 changes without any problems.
Here is what I have for my Before_Update event to keep track of changes:
Dim rs As DAO.Recordset
Set rs = CurrentDb.OpenRecordset("tblProjectNoteChanges", dbOpenDynaset)
With rs
.AddNew
If IsNull(Note1.OldValue) Then
![MajorIssuesOld] = "Previously no note"
![MajorIssuesNew] = Me.Note1.Value
Else
![MajorIssuesOld] = Me.Note1.OldValue
![MajorIssuesNew] = Me.Note1.Value
End If
If IsNull(Note2.OldValue) Then
![GeneralInfoOld] = "Previously no note"
![GeneralInfoNew] = Me.Note2.Value
Else
![GeneralInfoOld] = Me.Note2.OldValue
![GeneralInfoNew] = Me.Note2.Value
End If
![Changed] = Now()
.Update
End With
Set rs = Nothing
Any ideas? Is it the code, or is this placed in the wrong event? Any ideas would be greatly appreciated.
Thanks.
I needed to track changes every time any of the note fields changed.
I got that part to work and I put it in the Before_Update even as I'm using Note1.Oldvalue as well as Note1.Value for my changes.
The problem that I'm having with this code is that when I come back to this form and want to change Note1, it says that Access has encountered an error while saving the record and can't save.
When I take the Before_Update code out I can make my Note1 changes without any problems.
Here is what I have for my Before_Update event to keep track of changes:
Dim rs As DAO.Recordset
Set rs = CurrentDb.OpenRecordset("tblProjectNoteChanges", dbOpenDynaset)
With rs
.AddNew
If IsNull(Note1.OldValue) Then
![MajorIssuesOld] = "Previously no note"
![MajorIssuesNew] = Me.Note1.Value
Else
![MajorIssuesOld] = Me.Note1.OldValue
![MajorIssuesNew] = Me.Note1.Value
End If
If IsNull(Note2.OldValue) Then
![GeneralInfoOld] = "Previously no note"
![GeneralInfoNew] = Me.Note2.Value
Else
![GeneralInfoOld] = Me.Note2.OldValue
![GeneralInfoNew] = Me.Note2.Value
End If
![Changed] = Now()
.Update
End With
Set rs = Nothing
Any ideas? Is it the code, or is this placed in the wrong event? Any ideas would be greatly appreciated.
Thanks.