"ME" Code

jblackman

Registered User.
Local time
Today, 11:27
Joined
Feb 27, 2001
Messages
24
Can someone explain the difference between:
Me![Combo13]
and
Me.Combo13

Is there a difference in the way this is coded?
 
Hi J Blackman

My understanding is that the ! (bang) is used before items the User/Developer has named and the . (dot/period) is used before MS Access names.

So

Me.Requery

would be Ok as "Requery" is a term named by Access.

Me!Requery

wouldn't be OK.

Likewise

Me!cboNamedMyMe

would give the value of the combo box that you had named, but the following would not work:

Me.cboNamedByMe

Some references can use both:

Forms!frmMyForm!txtMyTextBox.Locked = Yes

"Locked" has a dot before it as it is an Access property/command/etc. The other parts have a bang as they are user/developer named.

HTH

Rich Gorvin
 
Here's the official explanation from the Access 97 online help:

Use the ! and . (dot) operators in expressions

You use the ! and .(dot) operators in an identifier to indicate the type of item that immediately follows.
The ! operator indicates that what follows is a user-defined item (an element of a collection). For example, use the ! operator to refer to an open form, an open report, or a control on an open form or report.

Identifier Refers to
Forms![Orders] The open Orders form
Reports![Invoice] The open Invoice report
Forms![Orders]![OrderID] The OrderID control on the open Orders form
The . (dot) operator usually indicates that what follows is an item defined by Microsoft Access. For example, use the . (dot) operator to refer to a property of a form, report, or control.

Note You can also use the . (dot) operator to refer to a field value in an SQL statement, a Visual Basic for Applications method, or a collection. For example, the identifier Forms![Orders].Controls refers to the Controls collection of the Orders form. However, because the Controls collection is the default collection for forms and reports, it's usually not necessary to refer to it explicitly.
 
All very interesting responses.... thank you all very much for the detail.... This site never ceases to amaze me. Have a great week!
 

Users who are viewing this thread

Back
Top Bottom