Actually it should not make sense since the replies are wrong. This is one of many reasons I recommend to stop using the bang operator. There is only one place you must use it, and that is in a Parameter query. I can think of about five other reasons why not to use it. Mainly it is sloppy shorthand that hides what is really going on.
The real name of the Bang operator is the Dictionary Lookup Operator. It works in one place only, to reference an object in a DEFALT COLLECTION with a NAMED index. For example take a Form object. The Form object has several collections, but the default collection is the Controls collection. Controls have string named indices. So in complete notation, with Me returning the instantiated object:
Code:
Me.Controls.index(“namedIndexOftheControl”).value
This says get the controls collection of the form, use the index method to return the named control from the Controls collection and get its value. By looking at this you know exactly what is happening. Now VB is sloppy and “index” is a default method, and value is a default property. The controls collection is the default collection, and it is indexed by strings. So in shorthand
Code:
Me!namedIndexOftheControl
Same with a recordset. The default collection is Fields. So
Code:
myRS.fields.index(“fieldname”).value
‘can be written as
MyRs!fieldname
Conversely to what was suggested, it does not link objects. Take the Recordsetclone of a from. You could not write
Me!Recordsetclone
It also has nothing to do with the control versus the value in the field. If you have a bound form with a control the same as your field name, when you add the control to the form it adds an object to the default Controls collection.
Me!fieldname
Is shorthand for
Me.Controls.index(“fieldname”).value
And returns the value of the control in the controls collection with index “fieldname”
Now when you drop a control on the form it is also given a property with the field’s name. So
Me.fieldname
Returns the value of the property. You can see this by dropping a field on a form and calling the control something different such as “txtBoxFieldName”. Look at the intellisense and see the difference between
Me.fieldname
And
Me!txtBoxFieldName
I hope this helps