Nobbie question about Me.

F

fossy

can some one give me a quick explanation about the "Me." syntax/keyword, I
been trying to find something about this but can't find anything usefull
thanks you
 
S

Stefan Hoffmann

hi,
can some one give me a quick explanation about the "Me." syntax/keyword, I
been trying to find something about this but can't find anything usefull
thanks you
It refers to your actual form or report where the code runs.



mfG
--> stefan <--
 
M

Michel Walsh

If you want an explanation with roots in the implementation, here is one.

When you define an class, there is the data part, and the code part..

When you instance an object from a given class, the 'data part' is created
in memory, in different memory addresses for each object, but the code_part,
which also lives in memory, is common to all the objects of the given class.
(It would be inefficient, memory wise, to store the code_part for each
different objects of the same class).


So, when the code run, from the code_part, the code may have to use a value
of the unique object who has called the code, in other word, the running
code has to be able to reach the RIGHT data_part of the RIGHT object, that
is what ME stands for: the data_part associated to the real object which
has called the code to run.


Sure, a FORM is a CLASS, and generally, you use only ONE object of a given
Form, so the 'class' thing seems to be an overworked solution, BUT you can,
indeed, open the same form many times (through code, not through the User
Interface), and then, ME takes all its importance.




Vanderghast, Access MVP
 
M

mike@work

i know this is the 3rd post saying the same thing, but i'm self taught and
not an expert so maybe i can simplify it. it's a vb thing really...

u could have 2 forms (form1 and form2) both with a control called text1.
when u write code on form1 u may wish to refer to the control on form2...
form2.text1.text="hello" or to confirm that u mean the control on form1
(where u are writing the code) u could put me.text1.text="hello"

it really just refers to the current form.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top