Reputation: 25
I have about 20 MS-Access databases with about 400 Forms and wish to perform an action whenever any form is loaded. I would need, perhaps, an event at database or application level that would trigger at any form being opened/loaded. Then I might need only to add code once to each of the 20 databases, but not to each of the 400 forms. And: it has to be in VBA (Access >= 2010)! My Question: Is this even possible? And if so, does someone have a hint? Thanks, Pete
Upvotes: 1
Views: 901
Reputation: 32632
There are multiple ways to go about this, I think.
What I'd probably do is the following:
You could also use VBA to iterate through all the forms, add a module to them if there is none, and then add your desired Form_Load
code to that module. (Would probably be wise to simultaneously create code to undo that action, so you can actually maintain the code). While refining that, you could check if the form already has a Form_Load
action, and append code to that if it exists.
Alltogether, possible, but difficult. If you want pointers on some of the steps, I can give them, but for major issues on the implementation, I'd ask a separate question.
Upvotes: 2