In one of my forms, I want to prevent the user from changing the recordset from one row at the time to the whole underlying table. I do so by setting the recordsoure to match the selection of a combo-box.

However, when letting the users search for a record in the underlying table, I need to change the record source to all records - which I do in the onclick event of a search button.

Now, When the search window is being displayed, I would like to prevent the user from accessing the form while searching (as the search window can be left open while switching back to a form etc, by default in office applications).

- Can I use code to force the user to close the search window before returning to the form? I still want the search function to highlight the values it finds in the form while searching...

- How do I capture the closing of the search window, so that I can change the recordset of the form to be limited to the record being displayed at just that moment?


A related question:
I also want to disable printing from certain forms or in certain conditions. How do I disable the print function by code?