T. McConnell
Registered User.
- Local time
- Yesterday, 22:33
- Joined
- Jun 21, 2019
- Messages
- 63
So I have run into yet another fun issue with my database.
I have 3 different forms that I utilize the Audit Trail with, this part is working fine finally. I now am running into an issue where on my forms I want to move the records to a Deleted Table to have a better viewing of what was on the record when it was deleted. What I have done is I have the below code that is to log the Audit file with a DELETE action, (Works) then I have a function in place to send an email as a notification a record was deleted, (Works) Next I turn off the warnings and run the a query to Append the record to a deleted jobs table, then a another query to delete the record. I then turn the warnings back on, and what I want to happen is for the form to go to a new record. Everything works up to the New Record part, I have tried removing the New Record command and just refresh the form, but I get a 3164 runtime error saying field cannot be updated, when looking at the debug it takes me to any line I have trying to either refresh, requery, or go to a new record. Any help would be greatly appreciated. I have also tried to just place the code on the Delete button, but I do have a msgbox on that which verifies submission or deletion of the record. Do I need to break this code up to different events?
Thank you to anyone who can help with this.
I have 3 different forms that I utilize the Audit Trail with, this part is working fine finally. I now am running into an issue where on my forms I want to move the records to a Deleted Table to have a better viewing of what was on the record when it was deleted. What I have done is I have the below code that is to log the Audit file with a DELETE action, (Works) then I have a function in place to send an email as a notification a record was deleted, (Works) Next I turn off the warnings and run the a query to Append the record to a deleted jobs table, then a another query to delete the record. I then turn the warnings back on, and what I want to happen is for the form to go to a new record. Everything works up to the New Record part, I have tried removing the New Record command and just refresh the form, but I get a 3164 runtime error saying field cannot be updated, when looking at the debug it takes me to any line I have trying to either refresh, requery, or go to a new record. Any help would be greatly appreciated. I have also tried to just place the code on the Delete button, but I do have a msgbox on that which verifies submission or deletion of the record. Do I need to break this code up to different events?
Code:
Private Sub Form_AfterDelConfirm(Status As Integer)
Call AuditChanges("JobID", "DELETE") 'updates the audit log
Call send_email1 'email function to send email for notification
DoCmd.SetWarnings False 'turn off warnings
DoCmd.OpenQuery "QryDeletedJobsAppend" 'Appends the record to the DeletedJobs Table
DoCmd.OpenQuery "DeleteJobQry" 'Deletes the record
DoCmd.SetWarnings True 'turns warnings on
DoCmd.RunCommand (acCmdRecordsGoToNew) 'go to new record
End Sub
Thank you to anyone who can help with this.