Is there an advantage to using the '!' notation to represent form/ control relationships? (eg. Me!text1 vs Me.text1) I am currently using the '.' notation exclusively (for code completion in the VB Editor), but much of the high-quality code that I've seen (in Duane Hookom's Query-by-Form db, for example) uses the other.
Here's one opinion for you: http://doc.advisor.com/doc/05352 robert.waters wrote: >Is there an advantage to using the '!' notation to represent form/ >control relationships? (eg. Me!text1 vs Me.text1) > >I am currently using the '.' notation exclusively (for code completion >in the VB Editor), but much of the high-quality code that I've seen >(in Duane Hookom's Query-by-Form db, for example) uses the other. -- HTH - RuralGuy (RG for short) acXP WinXP Pro Please post back to this forum so all may benefit. Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/Forums.aspx/databases-ms-access/200704/1
![]() |
0 |
![]() |
Here's my $0.02 worth on this. I tend to copy the notation style and naming conventions that I see being used in the Help files. That would be Me![text1] for a control on a form. I am of the belief that this notation explicitly refers to a control itself rather than a field in the form's recordset. Here's an example: I have a parts inventory app that uses a "Line" code, which is usually a 3-character abbreviation for a brand name, and is the name of both the field name and the bound text-box control on many of my forms. Because the word "Line" is one of those not-quite-a-reserved-word things ... so Access can get confused and pissy if I don't wrap it in square brackets. The "[Square Brackets]" format also allows for control names that may have spaces in them. (Not that I am in the habit of doing that.) Another benefit (to me anyway) is that I am so used to using this format that I do it by habit, so control references in my code really "stand out". Like you, I will often allow the supplied "." format from the code editor to get the spelling right (lazy), but then I go back and change it to the "bang and brackets" style before compiling. -- -- HTH, Don ============================= E-Mail (if you must) My.Name@Telus.net Disclaimer: Professional PartsPerson Amateur Database Programmer {:o) I'm an Access97 user, so all posted code samples are also Access97- based unless otherwise noted. ========================================================================== "robert.waters" <robert.waters@gmail.com> wrote in message news:1175821167.981097.263530@n76g2000hsh.googlegroups.com... > Is there an advantage to using the '!' notation to represent form/ > control relationships? (eg. Me!text1 vs Me.text1) > > I am currently using the '.' notation exclusively (for code completion > in the VB Editor), but much of the high-quality code that I've seen > (in Duane Hookom's Query-by-Form db, for example) uses the other. >
I don't feel there's an advantage, just preference. Some feel the Intelisense is an advantage, but for me, I prefer refering to any control on a form, from that form, using the '!'. When refering to form controls from other modules, I think the '.' is a required method. I've also heard arguments about increased likelyhood of errors or corruption using one over the other, but I haven't come across that happening yet.
On Apr 5, 10:12 pm, "Don Leverton" <leveriteNoJunkM...@telusplanet.net> wrote: > Here's my $0.02 worth on this. > I tend to copy the notation style and naming conventions that I see being > used in the Help files. > > That would be Me![text1] for a control on a form. I am of the belief that > this notation explicitly refers to a control itself rather than a field in > the form's recordset. > > Here's an example: > I have a parts inventory app that uses a "Line" code, which is usually a > 3-character abbreviation for a brand name, and is the name of both the field > name and the bound text-box control on many of my forms. Because the word > "Line" is one of those not-quite-a-reserved-word things ... so Access can > get confused and pissy if I don't wrap it in square brackets. > > The "[Square Brackets]" format also allows for control names that may have > spaces in them. (Not that I am in the habit of doing that.) > Another benefit (to me anyway) is that I am so used to using this format > that I do it by habit, so control references in my code really "stand out". > > Like you, I will often allow the supplied "." format from the code editor to > get the spelling right (lazy), but then I go back and change it to the "bang > and brackets" style before compiling. > > -- > -- > HTH, > Don > ============================= > E-Mail (if you must) My.N...@Telus.net > > Disclaimer: > Professional PartsPerson > Amateur Database Programmer {:o) > > I'm an Access97 user, so all posted code samples are also Access97- based > unless otherwise noted. > > ========================================================================== > > "robert.waters" <robert.wat...@gmail.com> wrote in message > > news:1175821167.981097.263530@n76g2000hsh.googlegroups.com... > > > > > Is there an advantage to using the '!' notation to represent form/ > > control relationships? (eg. Me!text1 vs Me.text1) > > > I am currently using the '.' notation exclusively (for code completion > > in the VB Editor), but much of the high-quality code that I've seen > > (in Duane Hookom's Query-by-Form db, for example) uses the other.- Hide quoted text - > > - Show quoted text - IMHO one should NEVER name a control the same as a field in the datasource. Poor naming convention. In fact in my convention, all controls are prefixed with a 1 or 2 letters that describe the type of control followed by the field name so that a text box that displays a field called Address1 would be called tbAddress1. I rarely if ever 'reuse' a name.