Me. or Me!

  • Thread starter Thread starter Jean-Paul De Winter
  • Start date Start date
Both will work fine. The first syntax makes use of the Intellisense feature
in Access so you can choose the control name from a dropdown rather than type
it. The second syntax is a shorthand way of expressing Me.Controls("Field1").

Hope This Helps
Gerald Stanley MCSD
 
Hi,


None. They both primary refer to the control, if there is one of the
supplied name. A control belong to the form (class with visual component), a
field belong to a table (abstraction of data organization). Only if there is
no control of the given name does ! refer to the field of the RecordSource
of the form.

I would use the dot, it uses the object-syntax, and allow you to get
intellisense.

Rather than the !, someone did suggest, in the past, to use
Me.Recordset.Fields("Fieldname")



Hoping it may help,
Vanderghast, Access MVP
 
I use Me!Field1 to refer to a control named "Field1" on a form, FROM THAT
FORM.

Me.Field1 refers to a property/method of the form in which the code
exists -- it refers to an underlying field, or possibly to a control with
that name, and can be (for you and/or Access) ambiguous.

The general rule of thumb I've seen is to use the dot (".") to refer to
built-in Access properties and methods, and the "bang" ("!") to refer to
user-created objects.

In later versions of Access, the Intellisense also works when using the
"Me!..." approach.
 
Back
Top