By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,490 Members | 1,398 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,490 IT Pros & Developers. It's quick & easy.

Deleting filtered records not working properly.

P: n/a
I'm using Access 2000 working in DAO at the moment and am having
trouble deleting a record from a form that has been filtered.

So I'm filtering a form and then when the user selects the record and
tries to delete it using that button on the toolbar (i haven't been
using any manually coded method) that default delete confirmation
message is not coming up even though the record is successfully being
deleted from the database.

Also any code that i put in Form_Delete, Form_AfterDelConfirm and
Form_BeforeDelConfirm is not being triggered.

Anyone know how to fix this? I don't have this problem when i don't
apply a filtered to forms.

thanks

Donald

Nov 13 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
A slight correction the form_delete event is being triggered, however
the Form_AfterDelConfirm and Form_BeforeDelConfirm events are not
being triggered even after i tried to use the code in the
documentation. ie.

Sub Form_BeforeDelConfirm(Cancel As Integer, Response As Integer)
' Suppress default Delete Confirm dialog box.
Response = acDataErrContinue
' Display custom dialog box.
If MsgBox("Delete this record?", vbOKCancel) = vbCancel Then
Cancel = True
End If
End Sub

Sub Form_AfterDelConfirm(Status As Integer)
Select Case Status
Case acDeleteOK
MsgBox "Deletion occurred normally."
cboTagSearch.Requery
Case acDeleteCancel
MsgBox "Programmer canceled the deletion."
Case acDeleteUserCancel
MsgBox "User canceled the deletion."
End Select
End Sub

Nov 13 '05 #2

P: n/a
On 4 Jun 2005 16:11:08 -0700, "deekay" <de*****@gmail.com> wrote:

Have you tried:
SetOption "Confirm Document Deletions", True
Read the help file on BeforeDelConfirm: this event does not fire when
this setting is False.

-Tom.

I'm using Access 2000 working in DAO at the moment and am having
trouble deleting a record from a form that has been filtered.

So I'm filtering a form and then when the user selects the record and
tries to delete it using that button on the toolbar (i haven't been
using any manually coded method) that default delete confirmation
message is not coming up even though the record is successfully being
deleted from the database.

Also any code that i put in Form_Delete, Form_AfterDelConfirm and
Form_BeforeDelConfirm is not being triggered.

Anyone know how to fix this? I don't have this problem when i don't
apply a filtered to forms.

thanks

Donald


Nov 13 '05 #3

P: n/a
"deekay" <de*****@gmail.com> wrote in
news:11**********************@g49g2000cwa.googlegr oups.com:
A slight correction the form_delete event is being triggered,
however the Form_AfterDelConfirm and Form_BeforeDelConfirm events
are not being triggered even after i tried to use the code in the
documentation.


I never depend on these event firing, because, as Tom says,
user-configurable options can cause them to never fire.

For deletions, I set the form so that AllowDeletions is off, and
have a dedicated DELETE RECORD button. That way I can control the
process myself.

I actually started doing that before I knew about the fact that the
global option caused the events not to fire, because I hated needing
to cache information about the record being deleted so that I could
supply a meaningful deletion message. What I mean by that is that,
by the time the Delete event happens, the record is gone, so you can
no longer collect data from the record to identify it in the
messagbox you pop up asking for confirmation. This is important,
because the displayed record at that point is *not* the one you're
deleting, but the one after it.

Because of that, I consider it crucial to have the confirm message
identify the record, and that could only be done by storing the
needed values in variables in the OnCurrent event (which also meant
you needed to have variables for the current record and for the
previous record, since by the time the delete event fires, a new
record is current).

With a custom command button, you can control the order of events,
presenting the confirmation message before the record is actually
deleted, so that you don't have to cache information about the
record.

--
David W. Fenton http://www.bway.net/~dfenton
dfenton at bway dot net http://www.bway.net/~dfassoc
Nov 13 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.