Thank you Minty
From post 3 of that thread In VBA, there are cases where you MUST use bang because dot doesn't work. And there are cases where you must use dot because bang doesn't work. Usually having to do with discovery of or enumeration of collections. So of course, there I do what I need to do to make it work.
Yet in my helping thread I changed the query criteria from
[Forms]![Domestic Faults]![sfm1].[Form]![cboDepartment]
to
[Forms].[Domestic Faults].[sfm1].[Form].[cboDepartment]
and it still worked, yet to my mind Forms is a collection?
I only had the . in the first line of code as that was what was shown in a Google search.
I am not sure why, but I really enjoy watching the HeavyWeights offering semi-opposing views. It could because I get reassured that there is hope for me and knowledgeable dialogue is beneficial.
Recently, Galaxiom revisited a thread he had participated with some interesting points on this, but I cannot find the @#$& thing now...
As an american I enjoy mocking your weird terms for things, but even I can't find fault with that. Not only is it cool and actually intuitive, its practical--1 syllable compared to our 5 syllables? Unfortunately, you guys win this one.
A lot has been said about dot versus bangs, much of it is wrong. I have contributed some less than precise stuff myself but the following is fairly accurate (given the limitations of time to fully explain it) and can be tested.
Full references use the Collection and Item names.
eg
The dot is an Early Bound reference to a member of an object. A member can be a Property, Method or via the defaults, an Item in a collection. A series of defaults chooses which collection has precedence if there is more than one and the complete reference is not spelt out. For a form it is the Controls Collection. (I suspect this default system has changed over different versions of Access.)
Forms.Controls.controlname is abbreviated to Forms.controlname by omitting the default.
Being early bound, dot references are tested during compilation. A reference to property, method or control that does not exist will throw an error during compilation so it is better to use the dot where appropriate.
The bang is shorthand for a Late Bound Reference to the default member of an object. Being Late Bound, any error due to an invalid reference will not be picked up during the compile. Exactly what the default member of an object is depends on the object but Properties and Methods are never the default so the dot must always be used for them.
Forms!controlname will compile even if the there is no control by that name, then error when the line is executed during run time.
"Forms!" or "Forms." is a grey area. Strictly speaking the Forms Collection is empty until a form is loaded, so a bang would be considered more appropriate but that is just academic because VBA doesn't care. In practical terms, a reference to a form in the query designer will only trigger Intellisense if the bang is used (A2010 onwards).
A recordset is a dynamic object, hence Early Bound is an oxymoron when referring to fields in it. Consequently items in the Fields Collection of a recordset must be referred to in shorthand via the bang. The dot will not work. The default member of a recordset is the Fields Collection.
Can't add to Galaxiom's advice on when to use each, but I can verify that the vernacular has included "bang" to represent "!" (exclamation point) ever since I started talking to UNIX programmers and that has been over 30 years ago. I also know that "dot" become popular in web addresses (named AND numbered) a long time ago, again at least 30 years.
For those who wonder why, I'm pedantic and proud of it! So, here's your reasons:
"Bang" is easier and faster to say than "Exclamation Point" and in literature, most of the time when you see the word "Bang" in print (usually to represent gunshots or small explosions) it is followed by an exclamation point anyway.
"Dot" has fewer syllables than "Period" or "Full Stop." But in old USA telegraphy, they DID use the word "STOP" to represent a period. The use of "dot" probably came in with Morse code along with "dash" (as opposed to the longer "minus sign").
People are ALWAYS looking for shorter ways to communicate. Which is why the Navy used to drive me nuts with their frickin' acronyms. For a while I used to be associated with NAVRESINFOSYSOFF (Naval Reserve Information Systems Office) and we couldn't use NRISO at the time because of overlap with some other service group.
But we are no better - we talk about FE and BE files, IP addresses, SMB protocols, etc. So... bang and dot have entered our vernacular, for better or worse.
As an american I enjoy mocking your weird terms for things, but even I can't find fault with that. Not only is it cool and actually intuitive, its practical--1 syllable compared to our 5 syllables? Unfortunately, you guys win this one.
There are a few experts who post a lot of code with Me!fieldname which I correct if I can to Me.fieldname. While technically fieldname is a user defined object and so should be preceded by a bang, in practice, Access adds the columns of the RecordSource to the Report's and form's Fields collection. The reason for using the dot rather than the bang to reference columns of the bound RecordSource is simply - early binding. You want compile errors rather than runtime errors whenever you have reference anomalies. Also, in earlier versions of Access, you didn't get intellisense with the bang but that seems to no longer be the case.
I see Galaxiom found his post. I remembered it being something on this topic the had not been discussed before (late/early binding) but not not recall it to save my skin.
I don't think so. What do our transatlantic cousins call a "?" - question point or question mark or query or something else entirely ? And I use shriek rather than bang.