Before/AfterDelConfirm events not firing

K

KC

I would be very grateful if someone could help me troubleshoot this
problem.

When I add a new record, save it, then immediately delete it, the
BeforeDelConfirm and AfterDelConfirm events DO NOT fire. In addition,
the confirmation dialog does not appear, the record is merely deleted.
When I add the record, navigate to another record, then navigate back
to the new record, these events DO fire and the confirmation dialog
appears.

Of course, I have repeatedly checked the Edit/Find Confirm check boxes,
they're all checked. I have sprinkled DoCmd.SetWarnings (True)
strategically throughout my code, to no avail.

I have confirmed that these events are listed as [Event Procedure] on
the form's property sheet.

I am using Access 2003 SP2, Windows XP Pro SP2.

Thanks in advance for any information you can provide.

Kevin
 
B

Baby Face Lee

Sounds like your Save procedure isn't saving the record.
As a cheat you could get the Save (button?) to navigate to the next record
and previous record in succession which will definately force a save. Your
delete confirms should then work.

Lee
 
K

KC

Thanks for the suggestion. How can I tell if the record is really
being saved? I am using the standard Access Save function
(Shift-Enter). This changes the record indicator from a pencil to a
triangle or whatever, so it looks like it's being committed to the
database.

This got me thinking that maybe it was some sort of locking issue, so I
changed the form from "No Locks" to "Edited Record" - to no avail.

Thanks,
KC
 
K

KC

I found it!

The problem is that I had the following code in my form's Current
event:

If Me.NewRecord Then
'Assign number to this new record
txtAcctNo.Value = MakeUniqueAcctNo
End If

The AcctNo is alphanumeric and is either user-specified, or uniquely
created by this function. In the problem situation, I was creating a
new record, changing the AcctNo to what it needed to be, saving the
record, then deleting it before I navigated to another record.

I don't fully understand why, but when I removed the above code, then
placed the following in my form's BeforeUpdate event, everything works
as expected:

If Me.NewRecord And IsNull(txtAcctNo.Value) Then
'Assign number to this new record
txtAcctNo.Value = MakeUniqueAcctNo
End If

I hope this might help someone else who encounters a similar situation.

KC
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top