Look at this for the "event behind another form's control" portion.
Hello everyone! I need to call the button_click procedure for a button on a form (button1), from another form, if you see what I mean!. Basically the user opens form1. They click a button which opens form2. Once they have finished on form2 they press the close button, which is the point where...
www.access-programmers.co.uk
The trick is that you have to open the other database (see "OpenDatabase") and make an object variable for it so that you provide a properly qualified context. An "unqualified" reference always points to the current database (see CurrentDB). DBOther.AllForms might be how you actually touch the form in question.
I'm working on my documentation tool and moving into unchartered waters. Up to now, I've been working with DAO objects and so having no trouble referencing them. Now I want to reference code and I found some useful code but it works for the current db. I need to figure out how to change the...
www.access-programmers.co.uk
THEN in that second database, you have open the form in question, because that is how you load the form (including loading the code). If you don't load the form (by opening it), you cannot touch the code at all because it is buried somewhere on the disk in a virtual (non-resident) area.
BUT if the button's event code isn't PUBLIC in this OTHER database, you might not be able to get to it anyway since by default, control event subs are PRIVATE and thus cannot be referenced from an external context. So anything you were consider for your testing would have to be marked specially as PUBLIC.
Before you ask why every event is private by default, I'll tell you. It is because events in forms generated by relatively normal methods will share a lot of the same names - like Form_Load or Form_Current or Form_BeforeUpdate - and thus having PUBLIC names would lead to a name conflict that would ALSO require an object variable for each such opened form to be able to tell the forms apart.
I'm not going to say you can't do this. There is just a LOT of preparation in anticipation of doing such a thing, and you would have to be meticulous in your coding conventions to keep from confusing anyone who might look at this code. (That would include you yourself if you wrote it and a year later had to go in to debug something.)