How to determine field value in BeforeDelConfirm event.

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a continuous form. When I a user deletes a record I want to know if
that record's date is a certain value before I allow the delete to occur.
However in the BeforeDelConfirm event that record's field values are no
longer accessible as the record cursor has already moved onto the next record.
 
The value of the deleted record(s) is not available in BeforeDelConfirm. Use
the Delete event to get the value.

It is possible to delete several records at once, e.g. if you select
multiple records in a continuous form or datasheet. The Delete event fires
once for each record, and the value is available each time. Then the
BeforeDelConfirm and AfterDelConfirm events fire once for all deletes, but
the values are not available at that time. You therefore need to write the
value(s) of the deleted record(s) to an array or temp table in the Delete
event if you want to read them in the BeforeDelConfirm event. There's an
example of doing that in this article:
Audit Trail - Log changes at the record level
at:
http://members.iinet.net.au/~allenbrowne/AppAudit.html

BTW, that description applies to data from JET (Access) tables. If you have
attached SQL Server tables, the order of events is different again.
 
Allen Browne said:
The value of the deleted record(s) is not available in
BeforeDelConfirm. Use the Delete event to get the value. [...]

BTW, that description applies to data from JET (Access) tables. If
you have attached SQL Server tables, the order of events is different
again.

Allen, I thought that was only for ADPs. Did I think wrong?
 
Yes, Dirk. I belive the difference is with ADPs.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps.org.
Dirk Goldgar said:
Allen Browne said:
The value of the deleted record(s) is not available in
BeforeDelConfirm. Use the Delete event to get the value. [...]

BTW, that description applies to data from JET (Access) tables. If
you have attached SQL Server tables, the order of events is different
again.

Allen, I thought that was only for ADPs. Did I think wrong?

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)
 
Back
Top