Advantage of using the Me keyword

cable

Access For My Sins
Local time
Today, 11:20
Joined
Mar 11, 2002
Messages
226
List Box in Form

sorry to butt in but what is the advantage of using the me.?
 
Example A.
Code:
Dim x As String
x = "Example"
txtMyTextBox = x

Example B.
Code:
Dim x As String
x = "Example"
Me.txtMyTextBox = x

Example A & Example B both work. The only difference is that the Me keyword has been used in the latter. This keyword references the current instance of a Class module (be it the Class module attached to a form or a standalone). It's use helps the compiler determine where an object is faster. When you say Me.txtMyTextBox, the compiler knows to immediately go to the current form (in this instance) in order to manipulate the textbox. If you don't use it - like in Example A - the compiler has to look through all the objects on the forum until it finds the one you are referring to. This, in effect, makes using the Me keyword slightly faster.

For more information on Me. over Me!, see dcx's post in the FAQ forum. :)
 

Users who are viewing this thread

Back
Top Bottom