The video of Karl Donaubauer's excellent presentation to Access Europe is now available on YouTube
Regarding example number 5:-
Subform used multiple times knows itself.
The name of the Subform/Subreport Control used in the example is misleading.
EDIT:-
It is misleading because it returns the name of the form contained within the Subform/Subreport Control when the Subform/Subreport Control was created. If the original form is replace with another, then the name returned would be incorrect. It would be safer to extract the name of the form from the the Subform/Subreport Control.
The code finds all the parent’s Subform/Subreport Controls "acSubfrm" and returns the name of the Subform/Subreport Control. Due to Microsoft's default of naming a new Subform/Subreport Control by the name of the Form/Report contained within it, you could be misled into thinking the object reported is a Form, where in fact the object is a Subform/Subreport Control "acSubfrm"
This problem can be avoided by renaming the automatically generated names of the Subform/Subreport Controls "acSubfrm" to follow a naming convention.
Using the Leszczynski naming convention
The Leszczynski prefix for a Subform is "fsub".
The Leszczynski prefix for a Form is:- "frm"
Note:- They are BOTH "identical" Form Objects, the different prefix is in regard to where they are used. A form prefixed with "fsub" is expected to be contained in a Subform/Subreport Control displayed on a form.
The recommended prefix for a Subform/Subreport Control is "sub"
Following the Leszczynski naming convention would return the Subform/Subreport Control name as:- "subfsubFormName"
An alternative prefix for a form destined to be a subform is:- "sfrm". Using this subform prefix would return the Subform/Subreport Control name as:- "subsfrmFormName" If you apply the “CamelCase” convention then the Subform/Subreport Control name would be:- "subSfrmFormName"
An alternative would be to use a custom naming convention for the Subform/Subreport Control. For example "subFrmWin" (meaning subform window) in this case the Subform/Subreport Control name would be:- "subFrmWinSfrmFormName"
Comment:-
The Microsoft automatic naming of Subform/Subreport Controls could be improved if it added the prefix "sub" to the form name extracted from the Subform/Subreport Control.