Hi,
the focus is now on a text field. I want to change the focus to the form, but how do I reference to the form? what is the difference between a "!" and "."? I get confused between these two symbols for referencing.
As for the ! or . issue, I picked this up off the internet a while ago (Wish I could remember where so I could give credit). It shouldgive you some guidelines on which to use.
Bang Vs. Dot
You sometime hear that: "the ! refers to user-defined things and . refers to Access-defined things." Although that is the standard rule of thumb, it is not exactly correct. More precisely, the bang (!) serves to separate an object from the collection which contains it, and the dot (.) serves to separate one level of the DAO hierarchy from another.
Let me back up.
DAO naming is hierarchical in nature, sort of like DOS. And like DOS, you can refer to an object using a fully qualified name or a semi-qualified name. In DOS, a fully qualified name would be like this:
C:\MSOFFICE\ACCESS97\TEST.MDB
If you assume the default directory, you can refer to the file by it's semi-qualified name: TEST.MDB.
So to, you can refer to an Access object by its fully qualified name:
or if you assume the default DBEngine (always), default Workspace, and default Database, you can refer to the table by its semi-qualified name:
TableDefs!Table1.
If you look at the fully qualified name like this:
DBEngine.
Workspaces(0).
Databases![c:\msoffice\access97\test.mdb].
TableDefs!Table1
you can see the DAO hierarchy levels more easily and how the dot separates them. (Much like the "\" in DOS).
The dot also serves to separate an object from its properties and methods, which can also be thought of as another level in the hierarchy. So I can refer to "TableDefs!Table1.RecordCount". RecordCount being a property of Table1.
The bang (!) separates objects from the collections which hold them, thus it separates "Table1" from the collection "TableDefs" and the object "c:\msoffice\access97\test.mdb" from its collection "Databases".
Since most objects are named by you, and since levels of DAO hierarchy are named by Access, we get the rule of thumb named earlier.
DAO Naming Rules:
1) The dot serves to separate one level of the DAO heirarchy from another in a fully qualified object name.
2) The dot also serves to separate an object from its methods and properties. (This, by the way, is the principle use for most people)
3) The bang serves to separate an object from the collection in which it is contained.
Prior to version 3.0 of DAO, you could use either the bang or the dot to separate an object from its collection. It is still supported for purposes of compatibility, but in 3.5, most objects don't support the dot for this purpose. You have to use the Compatibility Library to make this work, and future versions may not support it at all. Better to use the bang as intended.
As to your original question about changing the focus back to the form, I believe the answer is you cannot. If I remember correctly, the form cannot have focus if there are any controls on the form. What I have done in the past is to place a control on the form off in a far corner, reduce control to the size of a period, and pass focus to it.
Hope this helps.
The Missinglinq
"It's got to be the going,
not the getting there that's good!"
-Harry Chapin
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.