473,486 Members | 1,958 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

bang or dot? How to reference controls in queries?

all this dot and bang syntax is confusing. if anyone can bring clarity to
this subject I would really appreciate it.

Forms![frmMain]![frmSub].Form![ctl_on_Sub] -- to reference a text box on a
subform

But is this the same in a query??

Forms!frmMain!frmSub!ctl_on_Sub -- to reference a textbox on a sub form in a
query

what about nested sub forms?

Forms!frmMain!frmSub!frmNestedSub!ctl_on_NestedSub -- is this correct in a
query?

so you never use a dot in a query? only bangs?
are brackets necessary?

How about referencing the parent?

=Parent![ctl_on_ParentForm]

How about Me???

Me. or Me! ???

Me![frmSub].ctl_on_Sub
--or--
Me![frmSub]![ctl_on_Sub]
Nov 12 '05 #1
3 4688
"deko" <dj****@hotmail.com> wrote in
news:Ou********************@newssvr21.news.prodigy .com:
all this dot and bang syntax is confusing. if anyone can
bring clarity to this subject I would really appreciate it.

Microsoft suggested syntax is to use a dot when the word following
it is an Access word and use a bang if it's a programmer defined
word. But Wizard generated code often violates the recommendation.

me.visible
me!txtBox0
me!textBox0.visible
Forms!myForm!mySubform.form!txtBox0.visible

The only place I've had trouble when using the dot is with
set rst0 = x
rst0!fieldname works, rst0.fieldname sometimes gives an error.

Bob Q.
Nov 12 '05 #2
Just out of curiosity, does anyone know the programmatic significance
of this? What goes on behind the scenes?

Bob Quintal <bq******@generation.net> wrote in message news:<3a******************************@news.terane ws.com>...
"deko" <dj****@hotmail.com> wrote in
news:Ou********************@newssvr21.news.prodigy .com:
all this dot and bang syntax is confusing. if anyone can
bring clarity to this subject I would really appreciate it.

Microsoft suggested syntax is to use a dot when the word following
it is an Access word and use a bang if it's a programmer defined
word. But Wizard generated code often violates the recommendation.

me.visible
me!txtBox0
me!textBox0.visible
Forms!myForm!mySubform.form!txtBox0.visible

The only place I've had trouble when using the dot is with
set rst0 = x
rst0!fieldname works, rst0.fieldname sometimes gives an error.

Bob Q.

Nov 12 '05 #3
According to Access2000 Developer's Handbook (pg. 441):

-------------------------------------------
Just remember these rules:

-Dots (".") can only be used to preface properties or methods, not objects
within collections. Access makes a special case for controls on forms (and
reports), so you can use a dot to preface these objects. This can make your
code run a bit faster, if it references these objects

-Bang ("!") turns into parentheses/quotes around an object internally, so
there's little reason to use it. In any case, you use bang or
parentheses/quotes to separate an object from the collection containing that
object.
---------------------------------------------

But Bob's explanation is far more elegant and easier to remember - thanks,
Bob!

BTW, I, too have always been amazed (or amused?) at how often Microsoft
violates its own rules. You read the "theoretical" syntax rules, try and
carefully follow them, then go to the help menu for an example and it's
different - yet sadly works just as well or better!

Guess that's why they pay Access programmers the BIG bucks...

Mike Metzger
"Andante.in.Blue" <05********@sneakemail.com> wrote in message
news:bc**************************@posting.google.c om...
Just out of curiosity, does anyone know the programmatic significance
of this? What goes on behind the scenes?

Bob Quintal <bq******@generation.net> wrote in message

news:<3a******************************@news.terane ws.com>...
"deko" <dj****@hotmail.com> wrote in
news:Ou********************@newssvr21.news.prodigy .com:
all this dot and bang syntax is confusing. if anyone can
bring clarity to this subject I would really appreciate it.

Microsoft suggested syntax is to use a dot when the word following
it is an Access word and use a bang if it's a programmer defined
word. But Wizard generated code often violates the recommendation.

me.visible
me!txtBox0
me!textBox0.visible
Forms!myForm!mySubform.form!txtBox0.visible

The only place I've had trouble when using the dot is with
set rst0 = x
rst0!fieldname works, rst0.fieldname sometimes gives an error.

Bob Q.

Nov 12 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
1750
by: Mike Ayers | last post by:
Here is what I have: A lamp box (Linux,apache,mysql,php) that has >= 2.4Ghz Pentium 4, 1Gig Ram, 2 40 Gig IDE harddrives (OS on one/mysql on the other). The mysql database is getting large...
7
9662
by: Wolfgang Kreuzer | last post by:
Hello all, I have two tables - Projects and ProjectStruct Table Projects contains master records of the projects, ProjectStruct allows to define a project herarchie and contains the fields...
8
3483
by: Mike MacSween | last post by:
tblCourses one to many to tblEvents. A course may have an intro workshop (a type of event), a mid course workshop, a final exam. Or any combination. Or something different in the future. At...
44
7020
by: Darryl Kerkeslager | last post by:
I once did all my control references with the bang (!) operator. All my controls were referenced as Me!txtInput, etc. I have now discovered that doing this loses much more than Intellisense. ...
0
2295
by: Stephen Cairns | last post by:
I have the following rpx file in a .Net solution and I am getting the following build errors which are driving me crazy and ive no idea where I have went wrong. The build errors I'm getting are as...
3
2739
by: google | last post by:
I'm developing an application for use within my company in Access 2003. I'm new to '03, the application I did for my former employer was in '97. The two applications have similar functionality...
10
2524
by: MLH | last post by:
?DCount("!", "qryAOLsNeed2Print") - OR - ?DCount(".", "qryAOLsNeed2Print") Both syntaxes return the correct answer for me. But I'm wondering if one is more suitable than the other for some...
4
14681
by: Richard | last post by:
What is the difference between Me.Lastname Me!Lastname TIA
6
1802
by: =?Utf-8?B?UmljaA==?= | last post by:
If Not st1.Equals("something") then Do Something Else End If if str1 != "something" Then ... I realize that != is C# stuff and/or can be also be used in Tsql, but is there any implementation...
0
7099
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
6964
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7123
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
5430
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4864
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4559
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3069
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1378
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
598
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.