Capturing Property Of Deleted Record?

P

PeteCresswell

Got a subform that lists things with dates.

User can delete a thing.

But I need to know the date of the deleted thing.

Form_AfterDelConfirm leaves us pointing at one of the surviving
records.

I tried capturing the date to a module-level variable in Form_Current,
but the Delete process seems to trigger Form_Current so we wind up
overlaying the module-level variable's contents with the date of a
survivor.

Am I missing something obvious - like some sort of "OldValue" analog?
 
A

Allen Browne

Use the Delete event to capture the date.

Note that it is possible for the user to select multiple records and delete
them. When this happens, the Delete event fires for *each* one, so you will
need a way to remember multiple dates until AfterDelConfirm fires and you
know whether the the delete is for real or not.
 
K

KARL DEWEY

Why not add two fields - Archieve Yes/No and ArcDate DateTime.
Just flag the records instead of actually deleting and that way maintain
history.
 
C

Clif McIrvin

PeteCresswell said:
Got a subform that lists things with dates.

User can delete a thing.

But I need to know the date of the deleted thing.

Form_AfterDelConfirm leaves us pointing at one of the surviving
records.

I tried capturing the date to a module-level variable in Form_Current,
but the Delete process seems to trigger Form_Current so we wind up
overlaying the module-level variable's contents with the date of a
survivor.

Am I missing something obvious - like some sort of "OldValue" analog?


Pete - thinking out loud - I was going to suggest the BeforeDelConfirm
event; then decided to actually look it up first (probably a good idea
<g>).

From the installed help (A2003) for the BeforeDelConfirm event:
"You can delete one or more records at a time. The Delete event occurs
after each record is deleted. This enables you to access the data in
each record before it's actually deleted, and selectively confirm or
cancel each deletion in the Delete macro or event procedure. When you
delete more than one record, the Current event for the record following
the last deleted record and the Enter and GotFocus events for the first
control in this record don't occur until all the records are deleted. In
other words, a Delete event occurs for each selected record, but no
other events occur until all the selected records are deleted. The
BeforeDelConfirm event does not occur until all the selected records are
deleted."

So --- it looks like you need a combination of the Delete event(s?) and
the AfterDelConfirm event.
 

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