Greetings -
I am using a method so that if a user changes a record, he/she is prompted to confirm the change ("Do you want to accept the change?"). This prompt comes when the person leaves the record (it is a continuous form).
I find that even if no record is changed, if a person enters a record and then the database application is closed using the "X" in the upper right corner, the use is prompted as above, although there has been no record change. This does not happen when they use the "application.quit" function on a tab using the OnClick event, but only if closing with the upper right corner "X".
My code is:
I also tried adding a "or me.recordmodified = False" to the top argument but it didn't work. I'm not sure why the prompt is appearing without a record change. Is it because it is not a new record when the record is accessed and it either has to be a new record or the prompt will occur just by accessing the record? Again, this only happens when closing the database as I described above, not through an application.quit command.
Any thoughts or solutions would be appreciated.
Thanks.
I am using a method so that if a user changes a record, he/she is prompted to confirm the change ("Do you want to accept the change?"). This prompt comes when the person leaves the record (it is a continuous form).
I find that even if no record is changed, if a person enters a record and then the database application is closed using the "X" in the upper right corner, the use is prompted as above, although there has been no record change. This does not happen when they use the "application.quit" function on a tab using the OnClick event, but only if closing with the upper right corner "X".
My code is:
Code:
Private Sub Form_BeforeUpdate(Cancel As Integer)
If Me.NewRecord = True Then
Exit Sub
Else
If MsgBox("Changes have been made to this record. Do you want to save these changes?", vbYesNo) = vbYes Then
Me.RecordModified.Value = -1
Me.UserModifyStamp = NetworkUserName
Me.ModifyDateTimeStamp = Now()
Else
Me.Undo
End If
End If
End Sub
I also tried adding a "or me.recordmodified = False" to the top argument but it didn't work. I'm not sure why the prompt is appearing without a record change. Is it because it is not a new record when the record is accessed and it either has to be a new record or the prompt will occur just by accessing the record? Again, this only happens when closing the database as I described above, not through an application.quit command.
Any thoughts or solutions would be appreciated.
Thanks.