473,396 Members | 1,975 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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 4680
"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
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
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
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
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
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
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
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
by: Richard | last post by:
What is the difference between Me.Lastname Me!Lastname TIA
6
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
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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,...

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.