R
Rick
I have a Command Button on a form with the following on
click event:
Private Sub Command65_Click()
DoCmd.SetWarnings False
Me.FormResetDelete = 1
DoCmd.Save
DoCmd.OpenQuery "ArchiveCompletedFormsHistory"
DoCmd.OpenQuery "ArchiveClearFormsArchived"
DoCmd.Save
End Sub
The purpose is to have the current record marked for
archiving by inserting a 1 in the FormResetDelete field;
run the append query "ArchiveCompletedFormsHistory" to
copy the data to a history table; run the update
query "ArchiveClearFormsArchived" to reset most of the
fields on the form to null; and save the record.
The append and update queries run as expected. However;
the user has to click on the command button twice to
complete the task rather than just once. Further, after
clicking the command button twice and attempting to
navigate to the next record the following messages appears:
Write Conflict
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.
Save Record Copy to Clipboard Drop Changes.
Choosing any one of the three options results in a
successful completing of the archive and reset objectives.
What changes to the code are needed to prevent the
necessity of clicking the command button twice and to
avoid the Write Conflict warning?
click event:
Private Sub Command65_Click()
DoCmd.SetWarnings False
Me.FormResetDelete = 1
DoCmd.Save
DoCmd.OpenQuery "ArchiveCompletedFormsHistory"
DoCmd.OpenQuery "ArchiveClearFormsArchived"
DoCmd.Save
End Sub
The purpose is to have the current record marked for
archiving by inserting a 1 in the FormResetDelete field;
run the append query "ArchiveCompletedFormsHistory" to
copy the data to a history table; run the update
query "ArchiveClearFormsArchived" to reset most of the
fields on the form to null; and save the record.
The append and update queries run as expected. However;
the user has to click on the command button twice to
complete the task rather than just once. Further, after
clicking the command button twice and attempting to
navigate to the next record the following messages appears:
Write Conflict
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.
Save Record Copy to Clipboard Drop Changes.
Choosing any one of the three options results in a
successful completing of the archive and reset objectives.
What changes to the code are needed to prevent the
necessity of clicking the command button twice and to
avoid the Write Conflict warning?