如何让SubForms在MS Access 2013中与AuditTrail一起使用 [英] How to get SubForms to work with AuditTrail in MS Access 2013

查看:68
本文介绍了如何让SubForms在MS Access 2013中与AuditTrail一起使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我有一个表单和Subform,下面的scritp跟踪主表单数据很棒,我明白我需要做一个循环来跟踪子表单数据,子表单名称是SO_frm_Subform_Data_Input,其中的数据就是这个正在从外部表中提取,SO主数据提供一些子表单,无论哪种方式,我已经能够跟踪主表单上的更改,但我在哪里以及如何输入操作以循环到子表单和跟踪并回发到审计表。表单和子表单中的关键字段是SO DESIGN ID

以下是我的脚本:

So I have a form and Subform, the below scritp tracks the main form data great, I understand I need to make a loop to track the subform data also, the subform name is "SO_frm_Subform_Data_Input", where the data on this is being pulled from an outside table, the SO main data feeds some of the subform, either way, I have been able to track the changes on the main form, but where and what do I enter for the action to loop into the subform and track and post back to the audit table. The key fields in both the form and subform is "SO DESIGN ID"
Below is my script:

展开 | 选择 | 换行 | 行号

推荐答案

在我们开始之前你应该知道需要变量声明。请检查一下。


否则,我是否正确地断定你正在浏览主表单上的每个控件并在审计中为每个控件记录一个单独的记录?


您正在寻求帮助以包含子表单中的所有数据吗?在我看来,如果我是诚实的,那么在相关表格的 Form_AfterUpdate()事件程序中会做得更好。


代码是你吗?有一个特定的形式。看起来它可能在标准模块中。如果是特定表单,代码就比它需要的更笨拙。
Before we start you should certainly know about Require Variable Declaration. Please check it out.

Otherwise, am I right to conclude you''re going through each control on the main form and logging a separate record in the audit for each?

You are looking for help to include all the data in the subform too? It seems to me that would be better done in the Form_AfterUpdate() event procedure of the relevant form if I''m honest.

Is the code you have for a specific form. It looks like it may be in a standard module. The code is far more clumsy than it needs to be if it''s for a specific form.


我只在主表单上有两个项目正在记录变更,一个日期和Notes字段,我可以让他们没有任何问题,但在子表单上,我有另一个日期,他们想要跟踪更改,所有其他项目是几乎免费的文本供员工根据需要使用,减去工作流程日期。计划是使用审计表中更改的日期,然后使用旧数据和新数据对更改的ID进行查询,以制定度量标准。如果日期不会长时间改变,则必须说明原因中的原因等等。

一旦我在这个主要表格和子表单上得到这个工作,我将编辑工作来自不同部分的另外两组表单几乎完全相同的格式化。
I only have two items on the Main Form that are being recorded for changes, a Date and Notes field, I can get them working with no issues, but on the Sub Form, I have another date that they want to be tracked for changes, all other items are pretty much free text for the employee to use as needed, minus a work flow date. The plan was to use the date changed from the audit table, then make a query against the ID of the change with the Old and New data to make a metric out of. If the date does not get changed for a long time, a note must say why in the primary form and such.
Once I get this work on this primary form and sub, I will edit to work on two other sets of forms from a different section working almost the same formatting.


如果您要处理Form'模块中的代码,那么对Form和SubForm的引用都将是使用关键字


但是,没有其他令人信服的论点,甚至更清楚,更完整地解释了您的要求,我仍然建议审核SubForm中的数据的任何工作都应该在Form本身的模块中处理(SubForm中使用的那个)。

If you were to handle the code in the Form''s module then references to the Form and SubForm would all be using the keyword Me.

However, without a compelling argument otherwise, or even a much clearer and fully explained description of your requirements, I would still suggest that any work auditing the data in a SubForm should be handled in the module of the Form itself (The one used in the SubForm that is).

MarcM:

我只在主表单上有两个项目正在记录变更,一个日期和备注字段,...
MarcM:
I only have two items on the Main Form that are being recorded for changes, a Date and Notes field, ...



我怀疑这些控件在他们的标签中都有 SOAudit 然后是吗?


请记住,使用面向对象编程,这是事件驱动编程的工作原理,你可以有两个独立的位代码以无缝方式一起工作。它不需要在同一空间内编码以便一起正常工作。我希望这是有道理的。


我担心你最新帖子的其余内容都依赖于我在某种程度上意识到你的系统,我告诉你我很少。 IE浏览器。没有上下文,它只对你有意义。


PS。请在进一步说明之前确认您至少使用顶部的 Option Explicit 行更新了现有代码。正如链接文章中所解释的那样,这对任何严肃的系统来说都是最低限度的。

I suspect these controls both have SOAudit in their tags then yes?

Remember, with Object Oriented Programming, which is how Event-Driven programming works, you can have two separate bits of code working together in a seamless way. It doesn''t all need to be coded within the same space to work properly together. I hope that makes sense.

I''m afraid the rest of your latest post all relies on me being aware of your system to an extent that I''m not, so tells me very little. IE. Without the context it''s meaningful only to you.

PS. Please confirm before going any further that you have at least updated your existing code with the Option Explicit line at the top. As explained in the linked article this is a bare minimum for any serious system.


这篇关于如何让SubForms在MS Access 2013中与AuditTrail一起使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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