Methods for Referring to Objects

Bang (!) verses Dot (.) verses Quotes ("")

In general, you follow the bang with the name of something you created: a form, report, or control. The bang also indicates that the item to follow is an element of a collection. You'll usually follow the dot with a property, collection, or method name. Actually, under the covers, the bang separator really says, “retrieve the following object from the default collection of the parent object.”

Syntax Details Example
collection(“name”) n/a cat.Tables(“tblCustomers”).Fields(“Street Number”)
collection(var) Where var is a string or variant variable

strTable = “tblCustomers” <br />strField = “Street Number” <br />cat.Tables(strTable).Fields(strField) </html>|

collection(ordinal position) Where ordinal position is the object's position within its collection cat.Tables(0).Fields(0)

collection!name <br />collection![name] </html>|Brackets are necessary if name contains a nonstandard character, such as a space |cat.Tables(“tblCustomers”).Fields![Street Number] |