0

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.

4

1 回答 1

2

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

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
于 2012-05-24T07:50:19.897 回答