Rabu, 15 Agustus 2012

RE: [MS_AccessPros] Re: How to use vb to do something if a record is deleted

 

More detail ...

The events occur in this sequence:

On Delete (for each row)
Before Delete Confirm (for all rows about to be deleted)
After Delete Confirm (confirms that all rows were deleted and none cancelled)

You can use each Delete event to save the PKey of the row about to be deleted in
case you need to do some other cleanup in After Delete Confirm. You can also
count the rows. Note that you can also issue your own custom delete message in
Before Delete Confirm.

John Viescas, author
Microsoft Office Access 2010 Inside Out
Microsoft Office Access 2007 Inside Out
Building Microsoft Access Applications
Microsoft Office Access 2003 Inside Out
SQL Queries for Mere Mortals
http://www.viescas.com/
(Paris, France)

-----Original Message-----
From: MS_Access_Professionals@yahoogroups.com
[mailto:MS_Access_Professionals@yahoogroups.com] On Behalf Of Bill Mosca
Sent: Wednesday, August 15, 2012 5:32 PM
To: MS_Access_Professionals@yahoogroups.com
Subject: [MS_AccessPros] Re: How to use vb to do something if a record is
deleted

Connie

Let's assume that by "datasheet" you mean a form and not a table in datasheet
view.

Forms have an AfterDelConfirm event. That is triggered when a user selects a row
and deletes it. A confirmation message pops up saying "Are you REALLY REALLY
sure you want to delete that row or are you just clumsy?" If the user confirms
the deletion the AfterDelConfirm fires.

You can put whatever code you want in that event.

Regards,
Bill Mosca, Founder - MS_Access_Professionals
http://www.thatlldoit.com
Microsoft Office Access MVP
https://mvp.support.microsoft.com/profile=C4D9F5E7-BB03-4291-B816-64270730881E
My nothing-to-do-with-Access blog
http://wrmosca.wordpress.com

--- In MS_Access_Professionals@yahoogroups.com, mrsgoudge <no_reply@...> wrote:
>
> Good morning/afternoon,
>
> I have a situation where the user needs to be able to delete a record from a
datasheet and if that happens I want to perform a certain vb code. I know that
some recommend never deleting, which I will investigate if I ever create another
database but for now this is necessary.
>
> I did a google search and found something by Allen Browne but he mentioned
needing to account for several records being deleted and I couldn't get my head
around how to do that.
>
> I'd REALLY appreciate any help.
>
> Once again--thank you!
> Connie
>

------------------------------------

Yahoo! Groups Links

__._,_.___
Recent Activity:
.

__,_._,___

Tidak ada komentar:

Posting Komentar