I need to update the main form any time that i do a change on the main form or in the subform, so what i did is in the main form after update event i put this code
Private Sub Form_AfterUpdate()
Dim strSQL As String
strSQL = "UPDATE TreatmentDetails SET TreatmentDetails.LastUpdateDateTime = Now(), TreatmentDetails.LastUpdatedUserID = DLookup('[user_id]', 'qryUserSecurity', '[user_name] = LAS_GetUserName()') WHERE (TreatmentDetails.TreatmentDetailsID = [Forms]![Switchboard]![subfrmWindow].[Form]![TreatmentDetails].[Form].[TreatmentDetailsID]);"
Now in the subform i did the same, i add the same code, because it is running an update query, it is working ; when i change the subform and then i click anywhere in the form it does not give me any message, but if i click in a list box, that is listing all the records it gives me this message
"The data has been change. Another user edited the record and saved the changes before you attempted to save your changes.
Re-edit the record"
in the list box i have this On click event
Private Sub lstTreatment_Click()
'Move to the record selected in the control
Me.RecordsetClone.FindFirst "[TreatmentDetailsID] = " & Me![lstTreatment]
Me.Bookmark = Me.RecordsetClone.Bookmark
'******* Code End *********
what can i do to avoid this message