Re: When to use "." and when to use "!"



Just to add to the confusion there is yet another notation:

as an alternative to
Forms!frmMyForm.Visible
one can write:
Forms("frmMyForm").Visible
or
Forms("frmMyForm").Form.Requery
or
Forms("aForm").Controls("aControl").FormatConditions.FontBold = True

I prefer this style because I find it easier to read. Others may
complain about having to type too many extra characters.

Elsewhere, wherever possible I use the dot notation. The real
advantage this, apart from the autocompletion mentioned by someone else
is that errors are picked up at compile time. Errors (eg misspelled
names) when using ! are only picked at run time.

Jim


blgilbert@xxxxxxxxx wrote:
Generally, a dot exposes properties and methods and a bang (!) exposes
members of a collection. So forms!frmMyForm.Visible refers to the
visible property of frmMyForm, which is a member of the forms
collection. What makes this harder (or easier, depending on your
perspective) to grasp, is that Access has gotten more and more
forgiving about using the "wrong" notation.

.



Relevant Pages