[AccessD] Bang v. Dot

Rocky Smolin rockysmolin2 at gmail.com
Fri Aug 6 19:19:05 CDT 2021


It's easy enough, for me, knowing that fldABC could be the field or the
object (and probably because I wrote it,lol), I can tell from the context.
me.fldABC.SetFocus refers to the text box.

But I take your point.  It's not, shall we say, a 'best practice'.


r

On Fri, Aug 6, 2021 at 3:35 PM John Colby <jwcolby at gmail.com> wrote:

> Lol, Bad Boy.  I like knowing what I am dealing with by reading the code.
> txtABC is a text box, not a field in a table.  CboABC is a combo box not a
> field in a table.  lstABC is a list box not...
>
> Trying to figure out what fldABC actually refers to would suck.
>
> Just me.
>
> On Fri, Aug 6, 2021 at 10:41 AM Rocky Smolin <rockysmolin2 at gmail.com>
> wrote:
>
> > I have consistently broken oe of the basic rules of VBA - giving
> different
> > names to the object and the control source of the object.  When I bind a
> > text box, for example to fldABC, I give the text box the name fldABC
> > instead of txtABC.  It has saved me a lot of trouble and makes my code
> > easier to maintain.  And I don't have to struggle with knowing whether I
> > should use fldABC or txtABC.
> >
> > II know - bad boy.  But it works for me.
> >
> > r
> >
> > On Fri, Aug 6, 2021 at 6:06 AM Ryan W <wrwehler at gmail.com> wrote:
> >
> > > I think a lot of the confusion comes from the fact that all your
> controls
> > > on a form also end up in collections, which can be bang notated.... in
> > fact
> > > I think for a time that was considered "proper" to use a bang to
> access a
> > > control, and then naturally a dot to access a property of the control.
> > >
> > > eg
> > >
> > > Me!Username.SetFocus
> > >
> > > which is shorthand for
> > >
> > > Me("Username").SetFocus
> > >
> > > I use this page when I need a refresher:
> > >
> > > http://access.mvps.org/access/forms/frm0031.htm
> > >
> > > There were some articles written by the late David Fenton scattered
> > around
> > > the web that suggested MS Access did not corrupt as easily during
> > compiling
> > > or decompliling if you used bangs in place of dots where appropriate.
> >  I'm
> > > unsure if that still holds true.
> > >
> > >
> > >
> > > On Fri, Aug 6, 2021 at 7:35 AM Arthur Fuller <fuller.artful at gmail.com>
> > > wrote:
> > >
> > > > Thanks  Stuart.
> > > >
> > > > On Fri., Aug. 6, 2021, 6:28 a.m. Stuart McLachlan, <
> > > stuart at lexacorp.com.pg
> > > > >
> > > > wrote:
> > > >
> > > > > Prior to 2007, Access was very forgiving and you could mix up dots
> > and
> > > > > bangs with fewer
> > > > > problems.
> > > > >
> > > > > In 2007, MS tightened it up and applied the rules more
> consistently.
> > > > >
> > > > > In essence:
> > > > > A bang (!) indicates that what follows is a element of a
> collection.
> > > > > A dot (.) means a property, collection, or method name.
> > > > >
> > > > > For recordsets.
> > > > > rs.Addnew  '  method so it's a dot
> > > > > rs!Firstname = "Fred"   'it's an element of the recordset
> collection
> > > so a
> > > > > bang
> > > > > rs.Update ' again a method, so a dot.
> > > > >
> > > > >
> > > > > --
> > > > > Stuart
> > > > >
> > > > > On 6 Aug 2021 at 4:09, Arthur Fuller wrote:
> > > > >
> > > > > > When working with recordsets; I have seen both bang (rs!) and dot
> > > > > > (rs.) References. Wh6 is the difference? -- AccessD mailing list
> > > > > > AccessD at databaseadvisors.com
> > > > > > https://databaseadvisors.com/mailman/listinfo/accessd Website:
> > > > > > http://www.databaseadvisors.com
> > > > > >
> > > > >
> > > > >
> > > > > --
> > > > > AccessD mailing list
> > > > > AccessD at databaseadvisors.com
> > > > > https://databaseadvisors.com/mailman/listinfo/accessd
> > > > > Website: http://www.databaseadvisors.com
> > > > >
> > > > --
> > > > AccessD mailing list
> > > > AccessD at databaseadvisors.com
> > > > https://databaseadvisors.com/mailman/listinfo/accessd
> > > > Website: http://www.databaseadvisors.com
> > > >
> > > --
> > > AccessD mailing list
> > > AccessD at databaseadvisors.com
> > > https://databaseadvisors.com/mailman/listinfo/accessd
> > > Website: http://www.databaseadvisors.com
> > >
> > --
> > AccessD mailing list
> > AccessD at databaseadvisors.com
> > https://databaseadvisors.com/mailman/listinfo/accessd
> > Website: http://www.databaseadvisors.com
> >
>
>
> --
> John W. Colby
> Colby Consulting
> --
> AccessD mailing list
> AccessD at databaseadvisors.com
> https://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
>


More information about the AccessD mailing list