I've put together a fairly complex personnel database. The most complex part of it is the main personnel form: there are so many pieces of information that might be entered for a given person that I've broken it down into one main form with the person's name and roles in our organization, with a lot of subforms below that (with what subforms are visible being controlled by what roles the person acts in).
I created a search button to allow people to search personnel by last name. In addition to the simple "Ctrl+F" function, I wrote into the code of the search button that it should set the focus to the txtLastName field.
The search function works great-but only so long as I don't click in any of the subforms. Once that happens, if I thereafter click the search button, it apparently searches every field-in every subform. This freezes up Access for 10-20 seconds at a time for each search, as I am up to over 2000 personnel records in the database. I wrote the code that sets the focus to the txtLastName field specifically to avoid problems like this, so...what's going on?
I'm attaching a stripped copy of my database. I've put in a lot of fake personnel data to simulate the problem's effects. "Librarian Example" should pop up as the first record. If you click on the "Consideration/Hiring Information" tab and click in a field or two there, then search for the last name "Test20" you'll get an error message about hiding a control that has the focus-why is my code to set the focus to the txtLastName field not bypassing that? If you click "Find Next," you'll get an error message that says "The control 'frmEducationSubform' the macro is attempting to search can't be searched." Why is the macro attempting to search there?
I have put a lot of code throughout the Personnel form and its many, many subforms, so I imagine it might be interfering-but I can't quite understand how, and so can't tell if there is a simple way around it short of radically simplifying and redesigning the form. I did some searches to see if this was a common issue, but I haven't found much in the way of similar problems, so I imagine I am missing something basic.
Thanks in advance for any help anyone can provide.
I created a search button to allow people to search personnel by last name. In addition to the simple "Ctrl+F" function, I wrote into the code of the search button that it should set the focus to the txtLastName field.
The search function works great-but only so long as I don't click in any of the subforms. Once that happens, if I thereafter click the search button, it apparently searches every field-in every subform. This freezes up Access for 10-20 seconds at a time for each search, as I am up to over 2000 personnel records in the database. I wrote the code that sets the focus to the txtLastName field specifically to avoid problems like this, so...what's going on?
I'm attaching a stripped copy of my database. I've put in a lot of fake personnel data to simulate the problem's effects. "Librarian Example" should pop up as the first record. If you click on the "Consideration/Hiring Information" tab and click in a field or two there, then search for the last name "Test20" you'll get an error message about hiding a control that has the focus-why is my code to set the focus to the txtLastName field not bypassing that? If you click "Find Next," you'll get an error message that says "The control 'frmEducationSubform' the macro is attempting to search can't be searched." Why is the macro attempting to search there?
I have put a lot of code throughout the Personnel form and its many, many subforms, so I imagine it might be interfering-but I can't quite understand how, and so can't tell if there is a simple way around it short of radically simplifying and redesigning the form. I did some searches to see if this was a common issue, but I haven't found much in the way of similar problems, so I imagine I am missing something basic.
Thanks in advance for any help anyone can provide.