Where in a database would i find this code: Forms!frmCompanies!Search2
There are only two places where it can occur:
1. In the form that is currently open.
2. In something that is opened implicitly by the currently open form.
I'm saying that because this construct is meaningless unless the frmCompanies form happens to be open at the time. Otherwise, it is not a member of the Forms collection. Only of the Documents collection.
Under #1, you have the class module of the form itself, plus any controls that are bound in a parent/child relationship to something else (perhaps even via pop-up forms). This LOOKS like a reference such as a child form might make regarding a selection made on a parent form, but that is not the only place such a selection could occur.
Under #2, you have the general modules (all of them), queries that underly a control, and queries, forms, or reports triggered by event code in the class module of the open form.
I would open the form in design mode and look at the recordsource for the form and the controlsource for each control. If that doesn't work, I would next open the class module and search it for that exact string. (You can tell the search to go through the whole module.) Next, I would open any general modules and search them, one at a time (to prevent myself from becoming more confused than normal for me.)
Next, I would look at what the form does along the lines of opening other objects. I would repeat the class-module search for those objects, as well as the recordsource and controlsource examination.
When the object opened by your form is a query, I would look at the SQL code, too. When the object is a report, it can also have a class module, a recordsource for the report, and controlsource entries for each control.