gpt4 book ai didi

vba - 微软 Access : Capture values when record is deleted from subform

转载 作者:行者123 更新时间:2023-12-04 15:11:28 28 4
gpt4 key购买 nike

当我删除Form或SubForm中的数据时,我想在BeforeDelConfirm中捕获已删除的记录事件。我知道可以从“删除缓冲区”中获取数据以将其用于其他用途。

我不想使用Delete事件。我知道可以在记录集中实际删除数据之前从那里获取数据,但我希望它在 BeforeDelConfirm 上。 “删除”缓冲区中的事件。

我知道这是可能的,因为我几年前就做了,但我没有找到正确的代码,也没有在几个 Google session 中找到它。

最佳答案

Allen Browne 指出 Delete每个记录都会触发事件,但是 BeforeDelConfirm触发一次——即使选择了多个记录进行删除。所以没有机会捕捉这些值(value)。

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.



他提供了一个例子: http://members.iinet.net.au/~allenbrowne/AppAudit.html

关于vba - 微软 Access : Capture values when record is deleted from subform,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23121671/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com