Code

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

What is Me.blah or Me!blah. I have been seeing 'Me' all over the place andI
don't understand what this refers to.

Thanks

Frank
 
If the code is inside a form or report, you can use Me!blah
instead of Forms!FormName!blah .

You can't use Me! in a module or query.

Also there is some discussion about using Me!blah versus Me.blah which is
over my head.
 
Frank:

It actually refers to the current instance of the class in which the code is
executing. Most of the time you'll use it as if you were simply referring to
the form or report in whose module the code is, but there are circumstances
when you might have several instances of the same form open for example, in
which case Me refers to whichever one of those instances the code being
executed is in.

Nowadays its generally suggested that Me.SomeControl be used rather than
Me!SomeControl, but rather than either of those the recommended approach now
tends to be Me("SomeControl"). Each of these is in fact shorthand; the
latter for instance is actually an abbreviated form of
Me.Controls("SomeControl") but the reference to the Controls collection can
be omitted as it’s the default property of the Form class. Even this is
shorthand for Me.Controls.Item("SomeControl"), the Item property being the
default property of the Controls collection.

Ken Sheridan
Stafford, England
 
I only vagly understand both of you because I still don't know what Me is, I
think. Me is shorthand for the name of the form you are working with, Order
Form or Contacts or Customers or WhateverForm?.

But I think I understand what your saying Ken in that it's the differnece
between:

<a href="index.html"> and,

<a href="http://www.somewebsite.com/index.html">

Yes, No?!?

Frank
 
Frank:

To understand it fully you need to know a little about classes and instances
of a class. Think of those science fiction films where the same person
exists simultaneously in separate space-time dimensions, usually one a good
guy and the other the evil equivalent. When one says 'me' it refers to the
good guy instance of the person, when the other says 'me' it refers to his
evil counterpart. Me in VBA works much the same, potentially referring to
separate instances of the same form or report class. Most of the time
there's only one of each of us around so when you or I say 'me' it refers to
the one and only Frank or Ken. Similarly there's usually only one instance
of a form open at any one time so Me in its module refers to that one and
only instance.

Ken Sheridan
Stafford, England
 
Ken, Thanks for your explanation. It helped me understand it. Another example
would be the Michel J. Fox "Back To The Future" movies.
 
Back
Top