Me.

SueBK

Registered User.
Local time
Tomorrow, 09:08
Joined
Apr 2, 2009
Messages
197
What does ME. mean in VB? I'm using it 'cause I've been told what to write, but I'd like to understand what it's actually telling the program to do.
 
Me is an implicit reference to the class you wrote the code in. In context of Access, most of times, it's the forms or reports.

So therefore, if you have a form named "MyForm", the full and explicit referencing syntax (to get its name property for this example) is:

Forms!MyForm.Name

But when you're writing code in the module for the MyForm, you can shortcut the explicit reference into:

Me.Name

Did that help?
 
That's great, thanks. Always easier to work things out for yourself if you actually understand the "why" and "how" and not simply the "what".
 
Just wanted to add two more things:

1) Me, of course, is not valid in standard module because it's not a class and therefore has no object to refer to.

2) It goes without saying that Me may mean different things in different modules. So if you copy 'n' paste "Me.Name" in another module for a different form, the result may be different, which can be both good and bad, depending on what you actually want your code to do.
 

Users who are viewing this thread

Back
Top Bottom