Brian: I want to take this opportunity to thank you again for sticking with me.
I finally got it that when a button opens one subform, the rest of the lines of code for the button ensure that the other subforms are not visible. I now have four subforms opening off the main form. One of those subforms has a button which opens an additional subform, which itself has another table view subform nested within it.
The user can go back and forth between the subforms until they are certain they have the medical incident described correctly.
Many of the instructions I viewed on the internet, which are related to this issue, have to do with creating an entire application in visual basic. When the context is different, the code does not work in quite the same way.
When you are new to VBA you do not know this, and it makes you not trust the code. You just see that there are different ways of writing code in different settings to do the same thing. Accordingly, I had tiny errors in other places, and I thought it was another case of the code not working in my specific situation. I had a visibility setting that had become set to Yes again, which made one form open either under or over another. I had a typo in a subform name so small I could not see it, even when the debugger took me to the line with the error multiple times.
But, as I gained confidence in the code you provided I came to realize that if the code does not work, the error must be somewhere else.
You stayed with me when, at the beginning, I could not open any subform with a button. Now I have a complex web of subforms that all open and close correctly. I am sure I will learn more about how to make the entire application prettier but it now works the way it should.
I came across our thread on the internet while still searching for other answers to my questions. Anyone else who stumbles on this thread will receive all they need to create multiple buttons to open and close any number of subforms.
Note: I found one thread on the internet that was very similar. In it the event ID was not an autonumber. This means the user could skip that field. Then the entire rest of the data entered is not linked to anything. They had a complex web of code to prevent this, so the uer had to go back and enter an ID before opening a subform. You were the one who said to make the original event ID an autonumber. As soon as the user enters any information on the main form an event ID is created automatically and it is automatically contained in every subform and associated table with no user action required.
One final note: in the last nested subforms I had to create master/child relationships with more than one field. The tables had to be linked on the event ID and the patient ID. After I gained confidence in what you were saying, this too became matter of fact. So now the nested subforms retain both IDs. How cool is that!
Thanks again for sticking with me in this. This has been a giant leap forward for me. It is the best experience I ever had with any online service.
And I saw some great advertising too.
David