Page Sub Total Coding Question?

M

Marshall Barton

Jim said:
I found this code on http://support.microsoft.com/?kbid=296249

Me! pagesum = Me! RunSum - x
x = Me! RunSum


It works great! Can anyone explain what does the ( Me! ) do?


Me refers to the class module that contains the code (e.g.
the report's module). It is used to specify a non-name
specific object when it's the same object that contains the
PageSum and RunSum text box controls. If a control is in a
different object, such as a form, then you need to specify
the full object reference (e.g. Forms!someform.textbox).

It's not strictly necessary to use the parent object
reference when the control and the code are in the same
parent object, but it helps disambiguate a control from a
VBA variable of the same name. Using Me. is necessary when
you are referring to a form property or method.

By the way, I think it is better and more convenient to use
Me.textbox instead of Me!textbox. Dot invokes the
InteliSense list of available properties and methods and
will produce a compile time error if the control name is
mistyped.
 

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