473,406 Members | 2,867 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Deleting filtered records not working properly.

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
3 3362
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
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
"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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Mike Turco | last post by:
I'm working on an application that imports and exports tons of CSV data, like 64,000 records per file, and six or seven files in a set. First off, by the tine I import a few hundred thousand...
1
by: Ken | last post by:
I have a form that has a command button on it to open a report. The report is based on the forms data, if it's filtered the report is filtered, if the form is showing 100 records the report is...
2
by: HansP | last post by:
Hi, I am really in a deadlock with this problem. In my VS2005 C# handheld application, I have a grid with Workorders. Another grid (child) are the ACTIONS, performed for each workorder. ...
3
by: melnhed | last post by:
---Report the current filtered records from a Form--- Hello All, I've seen this topic discussed before, but the solution described then doesn't work in my particular case. My Config: ...
1
by: Shortstuff12345 | last post by:
This can be ignored... I did a bunch more searching and tried a few more things listed on different posts. I was able to get the delete query to work properly by adding a statement in the code...
0
by: Ironr4ge | last post by:
Hi everyone, By the rate its going it want be long till I start growing gray hair... but anyway.. to come to the point... I am trying to open the form "Languages" with a diffrent record...
4
by: Ironr4ge | last post by:
Hi everyone, I am trying to open the form "Languages" with a diffrent record source to the "Contacts" form where I conducted the search or filter... . I was wondering whether there was a vba...
14
kcdoell
by: kcdoell | last post by:
Hello: I have a form (Default view =single form) with a subform (Default view =continuous forms) embedded into it. In the form I have three controls that display the Division, Working Region &...
6
jinalpatel
by: jinalpatel | last post by:
I am using following code for searching records. 'Purpose: Build up the criteria string form the non-blank search boxes, and apply to the form's Filter. 'Notes: 1. We tack " AND " on...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.