A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » New Users
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

A really dumb question...



 
 
Thread Tools Display Modes
  #1  
Old May 31st, 2004, 09:41 AM
Sandra
external usenet poster
 
Posts: n/a
Default A really dumb question...

I am just starting to work with event procedures and
almost everything so far I have copied and pasted from
the nice people on this forum or from other places, so I
am clueless about some of this.

What does the exclamation point mean in the syntax like:

Me![Owner].Text = ""

versus something like

Me.Detail.BackColor = 12615680

which has a period instead of the exclamation point?

TIA,
Sandra
  #2  
Old May 31st, 2004, 11:02 AM
Marc
external usenet poster
 
Posts: n/a
Default A really dumb question...

snip
What does the exclamation point mean in the syntax like:

Me![Owner].Text = ""

versus something like

Me.Detail.BackColor = 12615680

which has a period instead of the exclamation point?


Conventionally, you use the exclamation for file field or control names, and
the dot for methods and properties. So in your first example, Owner is
either a field or control name and you are referring to the text property of
that field. In the second Me is a form or report, that has a detail section
(property) that has an attribute of backcolour which you are setting to a
particular amount.

In later versions of Access, it seems you can use the dot always and forget
about the exclamation.
Marc


  #3  
Old May 31st, 2004, 01:45 PM
John Nurick
external usenet poster
 
Posts: n/a
Default A really dumb question...

Hi Sandra,

The Me keyword refers to the form in which the code is running.

The dot . notation is used to refer to _properties_ of the form, like
properties of any other object; hence
Me.Caption
Me.Detail.BackColor

The bang ! notation is a shortcut to the form's Controls collection, so
Me!Owner
corresponds to
Me.Controls("Owner")

In addition, however, the form exposes its controls and fields as
properties of itself. So
Me.Owner
also refers to Me.Controls("Owner") and - unlike the ! notation - lets
you use the Intellisense autocomplete feature in the VBE.

If you give the controls different names from the fields they are bound
to - e.g. a textbox txtOwner bound to the field Owner - both the control
and the field appear as properties of the form and - for some purposes -
as members of the form's collection of controls:
Me.txtOwner.Value 'value property of textbox,
Me.txtOwner.FontName 'name of font used in textbox
Me!txtOwner!Value 'same
Me!txtOwner!FontName

Me.Owner.Value 'value property of field
Me.Owner.FontName 'error: fields don't have fonts
Me!Owner.Value 'same

Similarly, if there's no control bound to a field, the field appears as
a property and can also be referred to as if it were a control.

As far as I can make out the only place where you need to use the !
notation is when using a parameter query that collects its parameters
from controls on a form:
Forms![Form Name]![Control Name]




On Mon, 31 May 2004 01:41:15 -0700, "Sandra"
wrote:

I am just starting to work with event procedures and
almost everything so far I have copied and pasted from
the nice people on this forum or from other places, so I
am clueless about some of this.

What does the exclamation point mean in the syntax like:

Me![Owner].Text = ""

versus something like

Me.Detail.BackColor = 12615680

which has a period instead of the exclamation point?

TIA,
Sandra


--
John Nurick [Microsoft Access MVP]

Please respond in the newgroup and not by email.
  #4  
Old May 31st, 2004, 10:21 PM
Joan Wild
external usenet poster
 
Posts: n/a
Default A really dumb question...

Just to add to the other responses, you'll go a long way remembering
bang(!) if you named it, dot(.) if you didn't

--
Joan Wild
Microsoft Access MVP

"Sandra" wrote in message
...
I am just starting to work with event procedures and
almost everything so far I have copied and pasted from
the nice people on this forum or from other places, so I
am clueless about some of this.

What does the exclamation point mean in the syntax like:

Me![Owner].Text = ""

versus something like

Me.Detail.BackColor = 12615680

which has a period instead of the exclamation point?

TIA,
Sandra



  #5  
Old June 1st, 2004, 05:11 AM
david epsom dot com dot au
external usenet poster
 
Posts: n/a
Default A really dumb question...

In later versions of Access, it seems you can use the dot always and
forget

In all versions of Access, you can use the dot and forget about
the exclamation mark when referring to controls on a form.

In earlier versions of Access, you could ALSO use the dot when
referring to fields of a recordset.

(david)


"Marc" wrote in message
u...
snip
What does the exclamation point mean in the syntax like:

Me![Owner].Text = ""

versus something like

Me.Detail.BackColor = 12615680

which has a period instead of the exclamation point?


Conventionally, you use the exclamation for file field or control names,

and
the dot for methods and properties. So in your first example, Owner is
either a field or control name and you are referring to the text property

of
that field. In the second Me is a form or report, that has a detail

section
(property) that has an attribute of backcolour which you are setting to a
particular amount.

In later versions of Access, it seems you can use the dot always and

forget
about the exclamation.
Marc




 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 08:45 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.