I am so frustrated right now and just can't determine what my problem is! PLEASE HELP!
I am using Access 2007 to access SQL Server database tables. I have a form that just lists values in a table that only has two fields, both of which are displayed on the form. I have code in the Delete event to perform a validation to ensure that it is okay to delete the selected record. That seems to be working just fine.
I also have code in the AfterDelConfirm event to update other information in the table if the record is successfully deleted. This code is performed after an If statement checking the status field to ensure that the delete wasn't canceled. This event never fires and I can't figure out why! In fact, I'm never even getting the warning message to confirm the delete.
To be clear, I have already check that the checkbox for record changes confirm option is checked. I've also ensured that SetWarnings is set to true.
When I try to delete the record using the form, the result is that the form no longer shows the record. However, the physical record still exists in the table. If I close the form and reopen it, the record reappears.
Now for the really weird part -- I decided to create a standard form just using the Create > Multiple Items option for that same table. I simply added an embedded macro with a single msgbox command to each of the 3 delete events -- Delete, BeforeDelConfirm, and AfterDelConfirm. When I try to delete the record using this form, all three events are triggered and present each of the messages I told them to display in the msgbox commands. I also get the standard confirmation message warning me about deleting the record. I confirmed that in this case, the record is physically deleted from the table.
So, why is that form working and my customized one is not? I'm just baffled by this. I have other event procedures for my form, including BeforeUpdate, AfterUpdate, Open, and Dirty for each of my fields. They are all working just fine.
Can anyone help me solve this mystery?
I am using Access 2007 to access SQL Server database tables. I have a form that just lists values in a table that only has two fields, both of which are displayed on the form. I have code in the Delete event to perform a validation to ensure that it is okay to delete the selected record. That seems to be working just fine.
I also have code in the AfterDelConfirm event to update other information in the table if the record is successfully deleted. This code is performed after an If statement checking the status field to ensure that the delete wasn't canceled. This event never fires and I can't figure out why! In fact, I'm never even getting the warning message to confirm the delete.
To be clear, I have already check that the checkbox for record changes confirm option is checked. I've also ensured that SetWarnings is set to true.
When I try to delete the record using the form, the result is that the form no longer shows the record. However, the physical record still exists in the table. If I close the form and reopen it, the record reappears.
Now for the really weird part -- I decided to create a standard form just using the Create > Multiple Items option for that same table. I simply added an embedded macro with a single msgbox command to each of the 3 delete events -- Delete, BeforeDelConfirm, and AfterDelConfirm. When I try to delete the record using this form, all three events are triggered and present each of the messages I told them to display in the msgbox commands. I also get the standard confirmation message warning me about deleting the record. I confirmed that in this case, the record is physically deleted from the table.
So, why is that form working and my customized one is not? I'm just baffled by this. I have other event procedures for my form, including BeforeUpdate, AfterUpdate, Open, and Dirty for each of my fields. They are all working just fine.
Can anyone help me solve this mystery?