A ? about this groups conventions ??

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

Guest

I have been looking around here for a solution to a problem that I am having
with a report in access 2003.
Many of the suggested code snips are similer to the following:
Me.linMaxFlowRate.Visible = (Me.txtMaxFlowRate > 2000)

My question is this; is the "Me" in the code a generic reference to the
report or element name or is it used as some sort of recognised naming
convention that tells the report that it is referring to itsself ??
 
I'm not sure I understand the distinction you asked about.

When I use Me. (or Me! for objects I've created), I'm using it to refer to
the "container" object within which the code is running. In other words,
Me. is a shorthand way of referring explicitly to the form (or report)
within which the code runs, and refers to Access-derived methods/properties.

I use Me! when I'm referring to controls I've added in, so I would have
written the example you gave as:

Me!linMaxFlowRate.Visible = (Me!txtMaxFlowRate > 2000)
 
You can think of "Me" as a reference to the form or report in which this
code occurs. It works only in code.

I did not pick up the Me topic in the VBA window of Access 2003, so here is
the text from the topic in Access 97:

----------------------quote------------------
You can use the Me property in Visual Basic to refer to a form, report, (or
to the form or report associated with a subform or subreport), or class
module where Visual Basic code is currently running.

Setting

The Me property is available only by using Visual Basic and is read-only in
all views.

Remarks

The Me property contains an object reference to the current form or report
and is faster than a fully qualified object reference. For example, the
following two code fragments refer to the value of the LastName control for
the current record on the Employees form:

strLastName = Forms!Employees.LastName

strLastName = Me!LastName

In most cases, the form or report referred to by the Me property is the same
form or report referred to by the ActiveForm or ActiveReport properties of
the Screen object. However, these properties refer to the form or report
with the focus, whereas the Me property always refers to the form or report
in which code is running. For example, a Timer event can occur in a form
that doesn't have the focus. When that happens, the code Screen.ActiveForm
refers to the form with the focus, and the Me property refers to the form in
which the Timer event occurred. Therefore, when you are creating generic
procedures that operate on the current form, the preferred method is to pass
the form to the procedure by using the Me property rather than the
ActiveForm property.

You can use the Me keyword in class modules to refer to the current instance
of that class. Just as you use Me in form or report class modules to
retrieve a reference to the current form or report, you use Me in a class
module to retrieve a reference to the current class module object.
------------------end quote--------------------------------
 
Thanx Allen ! thats what i was needing to know. it is a key word vs. a way of
expressing the code in an example such as "foo.2foo.xfoo" or what ever it is
you "Gurus" use to show us newbies a representation of the code witout
knowing all the actual user specific names for reports, tables, controls etc.

Thanx
Klutzz
 
Back
Top