- Local time
- Yesterday, 18:56
- Joined
- Feb 28, 2001
- Messages
- 28,264
Inspecting the Form object will help you clear any doubts about Parent references. Several members of the Form class inherit Parent. In the example I provided, I'm using Parent to reference the same textbox from the BorderStyle property, an exercise to demonstrate that even a property can be used to reach the control. Information that is easy to understand through inspection.
Since inspection is never mentioned in threads about referencing controls, developers may get the wrong idea that there's only one way to do things, especially when they're presented with the link in post #6, when the information has always been in plain sight, not even hidden, because developers see it all the time while trying to debug the reference (if their locals window is visible). The syntax I'm using is THE exercise we should all be presented with when trying to reference something. The syntax is long, but it's consistent and you can use shortcuts if you want, like I mentioned. However, posts #2, #3, #5, #6, #7, #10 and #14 are using shortcuts, especially the link in post #6, which combines default members, bang and dot notation. How could new developers not get confused with this amount of variation?
I certainly don't want to suggest (for even a moment) that the long-sequence references to an object are technically wrong. However, given that the general category of Access is that it is a Rapid Application Development tool, the more you have to type, the less rapid it gets. For newbies and folks who have a congenital aversion to typing, shortcuts are essential tools in the toolbox. But let me ask this: When you use long-sequence references, do you start from Workspaces(0).Databases(0) - or maybe do you start from CurrentDB? OR, since CurrentDB is the default, do you just start with Me.something sometimes? I.e. is there a limit to how explicit your references will be?