397,939 Members | 4,483 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 397,939 IT Pros & Developers. It's quick & easy.

Difference between dot and bang notation?

Richard
P: n/a
What is the difference between

Me.Lastname
Me!Lastname

TIA

Feb 16 '07 #1
Share this Question
Share on Google+
4 Replies


storrboy
P: n/a
On Feb 16, 10:02 am, "Richard" <richard.goo...@devenezia.comwrote:
What is the difference between

Me.Lastname
Me!Lastname

TIA

The difference ultimately is where you use them and for what
reference. You can't reference a property or method with ! - just
objects. I have seen a lot of opinion about which is better used
where, but the practise I follow is...

- ! for an internal control reference. Eg. Code in a form module
refering to a control on the same form. - Me!Lastname
- . for an external reference and for properties and methods. Eg. in a
standard module - Forms("frmName").LastName.Visible

Feb 16 '07 #2

Tim Marshall
P: n/a
Richard wrote:
What is the difference between

Me.Lastname
Me!Lastname
In my own opinion, ultimately, the use of the dot lets you harness the
intellisense from the VBA which makes things much easier for code writing.

I've never had any problem using it.
--
Tim http://www.ucs.mun.ca/~tmarshal/
^o<
/#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake
/^^ "Be Careful, Big Bird!" - Ditto "TIM-MAY!!" - Me
Feb 16 '07 #3

Bob Quintal
P: n/a
"Richard" <richard.google@devenezia.comwrote in
news:1171638168.714505.250670@t69g2000cwt.googlegr oups.com:
What is the difference between

Me.Lastname
Me!Lastname

TIA
In theory, the dot refers to a property of an object, The bang
refers to a member of a collection.

In practice, controls on a form are considered like properties,
even though they are members of the form/report's controls
collection.

Use the dot except when it doesn't work About the only place I
can think of where it doesn't work is in a recordset when
referring to the fields by name.

rs1.fields("myField") and rs1!myfield will work.
rs1.myfield will trigger an error.

--
Bob Quintal

PA is y I've altered my email address.

--
Posted via a free Usenet account from http://www.teranews.com

Feb 16 '07 #4

PW
P: n/a
PW
On 16 Feb 2007 07:11:54 -0800, "storrboy" <storrboy@sympatico.ca>
wrote:
>On Feb 16, 10:02 am, "Richard" <richard.goo...@devenezia.comwrote:
>What is the difference between

Me.Lastname
Me!Lastname

TIA


The difference ultimately is where you use them and for what
reference. You can't reference a property or method with ! - just
objects. I have seen a lot of opinion about which is better used
where, but the practise I follow is...

- ! for an internal control reference. Eg. Code in a form module
refering to a control on the same form. - Me!Lastname
- . for an external reference and for properties and methods. Eg. in a
standard module - Forms("frmName").LastName.Visible

That's funny. I do the complete opposite of both those scenarios!

When I am writing code and want to reference a control on a form,
Access 2003 automatically locates the control if I type "dot" after Me
(Me.txtStartDate).

-pw
Feb 19 '07 #5

This discussion thread is closed

Replies have been disabled for this discussion.