Perhaps your search term was lacking something, because there's lots on the subject. However, the major difference is that ! provides late bound access to the default member of an object by passing the name that follows ! as an argument (string).I will try; I tried a general google search which returned little.
I wonder how much speed do you think you would be gaining if that's the case?Micron, since they will not be evaluated upon compile, does that mean they would also be slower?
I'm not an expert on Access architecture but don't see why there'd be any performance issue. Even if there was, you would not notice the difference, I strongly suspect. When I write code, I frequently compile and can't imagine why I would risk misspelling an object name in a reference only to have it bomb out during use because I used ! over dot. Intellisense might be the best reason to use dot, but having my references compiled on demand is a close second.Micron, since they will not be evaluated upon compile, does that mean they would also be slower?
That is not a correct explanation. There are plenty of examples of objects that you create where bang cannot access them (the property is not the default method), and there are examples of objects that you did not create that are accessible through bang. The correct definition is what Micron and I provided earlier:bang is used for objects that you create
A great example is the database object which has tabledefs and querydefs. Tabledefs is the default property and querydefs is not.The bang operator causes the runtime to invoke the DEFAULT member of an object and pass the name following the bang as a string argument.
Public Sub TestIt()
Dim db As DAO.Database
Set db = CurrentDb
MsgBox db!tblPlayers.Name 'works because tabledefs is default member of database
'MsgBox db!qryPlayers.Name 'does not work because querydefs is not default member.
MsgBox db.QueryDefs!qryplayers.Name ‘works because item is default method of query defs
End Sub
Which is the same as what I wrote earlier? But you provided good examples.The correct definition is what I provided earlier1.
Whenever you change the recordsource of a form, Access will internally create an object of type AccessField for each field in the recordsource and add it to the Controls-Collection of the form. However, the Controls-Collection treats those special controls differently than controls created explicitly by the developer. They can be referenced by name only. They are not included in Controls.Count, cannot referred to by Index and are not returned by the iterator for the collection.However, this also works for some reason.
MsgBox Me!SomeField.name
What is stranger about this is that there is not even a fields collection exposed by a form or report.
They did not really change the rules but refined and improved the mechanism described above. If I remember correctly, there was a time when that mechanism only worked when you changed the recordsource at design time but not at run time.Also, over the years, MS has changed the rules on ! vs . so it seems to currently be a free for all but it didn't used to be.