MS Access-粘贴确认事件后 [英] MS Access - after Paste confirmation event

查看:74
本文介绍了MS Access-粘贴确认事件后的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当用户将记录直接粘贴到数据表子报表中时,是否在显示粘贴确认消息之后捕获事件?我需要它能够在审核表中创建新记录时进行记录.

Is it possible to capture an event AFTER the paste confirmation message has been displayed when a user pastes records directly into a datasheet subreport? I need this to be able to log when new records are created in an audit table.

通过捕获更新之前/之后和插入事件,我可以轻松创建已添加的记录的集合,准备将详细信息插入审核日志,但是在所有这些事件触发后,系统会提示用户确认带有您将要粘贴x条记录"的消息.

By capturing the Before/After Update and Insert events, I can easily create a collection of records that have been added, ready to insert details into the audit log, however after all these events have fired the user is then prompted to confirm with a "You are about to paste x record(s)" message.

所以问题是用户可以在此处单击否",而我找不到任何捕获方式,这意味着所有插入内容都可以捕获在审核日志中,但是当用户取消请求时,记录将不会实际上不存在.

So the problem is the user may click "No" here, and I can't find any way of capturing this, meaning the insertions could all be captured in the audit log, but as the user cancelled the request the records wouldn't actually exist.

我认为处理此问题的唯一方法是创建一个临时表以显示现有记录,并添加一个保存"按钮将临时表写回,但要事先进行比较以更新审核日志.但是,这并不理想,尤其是其中有多个表.

The only way I can think of handling this is to create a temp table to display the existing records, and adding a "Save" button to write the temp table back, but running a comparison beforehand to update the audit log. However, this isn't ideal, especially as there is more than one of these tables.

推荐答案

如果使用数据宏,则可以实现此目的.我设置了一个表TestDataTable,它看起来像这样,将被审核

If you use a Data Macros you can achieve this. I set up a table, TestDataTable, that looks like this which will be audited

和这样的审核表

我在TestDataTable

插入后的外观如下

更新后看起来像这样

和删除后"看起来像这样

and After Delete looks like this

哪个会生成如下所示的记录

Which generates records which looks like this

如果您粘贴数据,但在粘贴确认中单击否",则Access会为您处理一切.这些记录不会添加到您的主表中,也不会插入任何审计记录.

And if you paste data in but click NO on the paste confirmation Access takes care of everything for you. Those records are not added to your main table and no audit records are inserted.

这篇关于MS Access-粘贴确认事件后的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆