Hi, I am working with Access 2003.
I have a MainForm with few subforms. I want to update the "LastUpdated" field in the source table of MainForm, but I get "Write Conflict" message. There are no other users on my PC.
Here is the code in MainForm:
Private Sub Form_BeforeUpdate(Cancel As Integer)
Dim MyRecSrc As String
Dim rst As DAO.Recordset
Dim db As Database
If Not Cancel Then
Set db = CurrentDb
MyRecSrc = Me.RecordsetClone.Name
Set rst = db.OpenRecordset(MyRecSrc)
rst.Edit
rst.Fields("LastUpdated") = Now
rst.Update
Set rst = Nothing
Set db = Nothing
End If
End Sub
What I am doing wrong? Thank you.
I have a MainForm with few subforms. I want to update the "LastUpdated" field in the source table of MainForm, but I get "Write Conflict" message. There are no other users on my PC.
Here is the code in MainForm:
Private Sub Form_BeforeUpdate(Cancel As Integer)
Dim MyRecSrc As String
Dim rst As DAO.Recordset
Dim db As Database
If Not Cancel Then
Set db = CurrentDb
MyRecSrc = Me.RecordsetClone.Name
Set rst = db.OpenRecordset(MyRecSrc)
rst.Edit
rst.Fields("LastUpdated") = Now
rst.Update
Set rst = Nothing
Set db = Nothing
End If
End Sub
What I am doing wrong? Thank you.
Last edited: