473,326 Members | 2,147 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,326 software developers and data experts.

Discussion: Dot Versus Bang (Again)

zmbd
5,501 Expert Mod 4TB
{Mod Comment - This was moved here as it developed into a discussion that was extra to what was required for the original question, which can be found at Is it Possible to Reference a SubForm in DoCmd.SearchForRecord?}

OK,
I guess....
Back from the deep dark recesses of my mind back to the 1997

IMHO they fixed this in the 2003 wherein the dot and bang appear to cover the same ground in that controls are now expressed as properties of the form unless a reserved word is used as a control or a bound field name and that name is used as a property of the form, i.e. "name," in which case you really have to use the bang to get the right return (YAR not to use reserved names and special characters and anything except alphanumerics and reserved words).

SO, if I remember right from my classes: dot = property, bang = member of collection.

So using that concept we build the generic reference:
Form!frmMainParent!sFrmSubForm.FORM!control_or_rec ordfield_name

SO to move on to what I coded (still generic reference):
Form!frmMainParent!sFrmSubForm.FORM.Recordset.Find First [conditional string]
I think that in English I'm saying:
In the collection of "FORMS"
find the item "frmMainParent"
within the collections of "frmMainParent"
find the item "sFrmSubForm"
that has a property "FORM"
that has a property "Recordset"
that has a property "FindFirst"
that requires a agument [conditional string] that acts on this described object.

Make me head hurt... I go watch pretty colours lab now...
Dec 11 '12 #1
5 1435
NeoPa
32,556 Expert Mod 16PB
I don't believe that is correct Z. Bang (!) is shorthand for various defaults generally. It only means Member of Collection when referring to an item in a collection and is shorthand for the fuller expression of how to reference a member in a collection. It is also shorthand for other defaults in various scenarios.

In the case of controls on a form within a subform, the full expression is SubformName.Form.ControlName. The shorthand expression, because .Form is the default item when referring to a subform control, is SubformName!ControlName. That isn't what I was asking about, as I already know that fairly certainly (See the linked article for more examples).

What I was asking for was an explanation, within that understanding, of why the shorthand reference to the .Recordset object property doesn't appear to be valid.
Dec 12 '12 #2
zmbd
5,501 Expert Mod 4TB
one thought on the dot-v-bang(http://blogs.msdn.com/b/frice/archiv.../18/75685.aspx

As for Form being the default property of the subform. I do not believe that you are correct... instead is it not the controls collection the default property of the form? http://msdn.microsoft.com/en-us/libr.../ff195841.aspx
Each Form object has a Controls collection, which contains all controls on the form. You can refer to a control on a form either by implicitly or explicitly referring to the Controls collection. Your code will be faster if you refer to the Controls collection implicitly.
Why the explict FORM for a Subform? Because we are refering to the FORM property of the subform CONTROL http://msdn.microsoft.com/en-us/libr.../ff194652.aspx

So we have SubformName.Form.controls!ControlName
or to use MSDN's: Forms!OrderForm.ctlSubForm.Form!Controls.NewData which is equivalent to Forms!OrderForm.ctlSubForm!NewData



Although I am sure the the bang has many other uses... how I understand it and the dot was explained to me by fairly knowledgeable person (he's about 20yrs my senior) is that, in general, if you use the "('x')" construct ie: (obj.item("name")) then, usually only then, you can replace it with the bang (obj!x). Of course I've found exceptions to that rule and I expected to do so when he used the terms "usually" and occationally even he has mis-understood a thing or two.
Dec 12 '12 #3
NeoPa
32,556 Expert Mod 16PB
Thanks for the links. I've studied many over the years - very few of which agree with others (Always the way). In this case, the fact that FRice seems unable, or unwilling, to differentiate between what is handled by the bang (!) and what is an effect of the default property of an object, leads me not to place too much weight on his understanding of the matter. In the case of Forms!MyForm!MyTextBox, the bang does not tell it to use the default property of the form. That is inherent in the concept of the default property of the form itself (which is the Controls collection of course).

The second link interestingly states that :
  1. Forms are members of the Forms() collection. Not too reliable as subforms are not.
  2. Using the implicit version is faster than the explicit one. I've heard this before but would be very interested to understand why. Possibly simply related to the time taken to interpret the code itself.
  3. You can use or bypass the .Form part of a subform reference, but not why.
Tantalisingly intersting points that are referred to, but not explained. And all this from MS.

You'll see much of what we've discussed included in my linked article about how to refer to subform items from post #16 (Referring to Items on a Sub-Form), and like your mentor, I have also been searching for a fuller understanding of Exactly what it means and where and when it's best to use each, even having a long discussion with Denburt about this some years ago. What I'm after is a full understanding of the issue, and knowing that it generally refers to collections, while perfectly true, is not something I'm satisfied by. I'll continue searching.
Dec 12 '12 #4
zmbd
5,501 Expert Mod 4TB
Wherein you find "Tantalising" I find very annoying... one would think they'd either standardize the use, or get rid of one or the other.
Personally, form my sanity, I try to use the bang only when dealing the recordset level of the forms or an open recordset with VBA and use the dot elsewhere.

However, it looks like we've gone slightly off topic... maybe split this out with reference starting around post#22?
Dec 12 '12 #5
NeoPa
32,556 Expert Mod 16PB
Z:
Wherein you find "Tantalising" I find very annoying... one would think they'd either standardize the use, or get rid of one or the other.
I certainly find it irritating that the situation is never explained clearly anywhere, such that even many very experienced Access developers are unaware of the full story. I feel more comfortable understanding and following the Rules, rather than simply bungling through in ways that can be got to work.
Dec 12 '12 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: Kevin | last post by:
Hi! I recently completed a graduate level Java class at a local university. For our class project my group built a web-based application. Basically, the application would let a manufacturing...
40
by: Eitan | last post by:
Hello, I know Java-Applet (written for JBuilder). I would like to know about dotnet technology, pros and cons in comparation to Java-Applet technololgy. Can I write a program in dotnet, like...
22
by: Keith Tizzard | last post by:
I know this subject has been discussed many times and I do not wish to go over all the ground again but I have a particular problem. In the code for a Form I always use the dot notation to refer...
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. ...
13
by: JayCallas | last post by:
I know this question has been asked. And the usual answer is don't use cursors or any other looping method. Instead, try to find a solution that uses set-based queries. But this brings up...
135
by: Xah Lee | last post by:
Tabs versus Spaces in Source Code Xah Lee, 2006-05-13 In coding a computer program, there's often the choices of tabs or spaces for code indentation. There is a large amount of confusion about...
1
by: Paulo Almeida | last post by:
Hi all, On the rfc4329 it says that the Internet Media Type text/javascript is now obsolete in favor of application/javascript. But the majority of people keeps using text/javascript and even...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.