(Copied from MS Access help file) also found here:
http://msdn2.microsoft.com/en-us/library/aa223099(office.11).aspx
Expand|Select|Wrap|Line Numbers
- ' Implicitly refer to NewData control in Controls collection.
- Me!NewData
- ' Use if control name contains space.
- Me![New Data]
- ' Performance slightly slower.
- Me("NewData")
- ' Refer to a control by its index in the controls collection.
- Me(0)
- ' Refer to a NewData control by using the subform Controls collection.
- Me.ctlSubForm.Controls!NewData
- ' Explicitly refer to the NewData control in the Controls collection.
- Me.Controls!NewData
- Me.Controls("NewData")
- Me.Controls(0)
Expand|Select|Wrap|Line Numbers
- Me(MyVariable)
If you use a period after Me then the program is looking for a property or method not an object although MS Access can be forgiving the one time it fails on you will probably be when you need it most (Murphy’s law).
Many people say that they do it that way because of the properties dropdown box, yeah when I was a noob I used the properties box but still went back and changed the period to the exclamation. Sometime later I found that after I type Me! I press Control and hold it then hit the space bar viola a dropdown I can use.
Remember that when you name your controls try to avoid anything that can be used by MS Access such as Date. Date is a function in MS Access so it is not wise to name a field that. I know I may here some arguments over the following however I have had issues with some of the following so I always recommend that people avoid spaces in field names and any odd characters such as underscores.