Access 2010:哪个表单控件触发宏? [英] Access 2010: Which form control fires a macro?

查看:69
本文介绍了Access 2010:哪个表单控件触发宏?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在处理旧数据库.具体来说,更改报告.我已经确定了报告所基于的查询/表格.其中一个表具有作为临时表的所有特征,由一个宏生成,其中有几十个.

I'm working on a legacy database. Specifically, changing a report. I have identified the queries/tables the report is based on. One of the tables has all the hallmarks of being a temprary table generated by a macro of which there are many dozens.

我已经能够识别生成表的附加查询和运行查询的宏.现在我想找到哪个表单事件触发该宏.它是在每次生成报告时运行还是每周一次或每季度一次或...打印报告的按钮"后面的宏中没有任何内容,报告中也没有触发任何事件.

I've been able to identify the Append Query which generates the table and the macro that runs the query. Now I would like to find which form event fires that macro. Does it run everytime the report is generated or once a week or once a quarter or... There is nothing in the macro behind the "button" that prints the report and no events are fired in the report.

我可以迭代每种形式的每个控件,但是我要寻找什么属性?任何指针/关键字指导将不胜感激,谢谢.

I can iterate over every control in every form, but what property am I looking for? Any pointers/key word guidance would be appreciated, thanks.

推荐答案

一些注意事项,有宏的名字会更容易找到相关按钮:

Some notes, it will be easier to find the relevant button when you have the name of the macro:

Sub FindMacros()
For Each f In CurrentProject.AllForms
    DoCmd.OpenForm f.Name, acDesign

    Set frm = Forms(f.Name)
    For Each ctl In frm.Controls
        If ctl.ControlType = acCommandButton Then
            Debug.Print ctl.OnClick
        End If
    Next

    DoCmd.Close acForm, f.Name, acSaveNo
Next
End Sub

这篇关于Access 2010:哪个表单控件触发宏?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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