Is possible?

  • Thread starter Thread starter Guest
  • Start date Start date
I should also add that using Me.MyControlName
also has the advantage that intellisense works
when you push dot after MyControlName or
even after Me.

Yes, that is the case, and is why I normally use the "." these days. David,
however, is absolutely correct that "." is not usable between the name of a
recordset and the name of a field in that recordset.

However, I have never seen documentation of the steps you describe, and as
Microsoft is reluctant to disclose details of internals, wonder if you are
simply assuming that is what happens, if you have an inside source at
Redmond, or if the steps are, in fact, documented. In many cases, Access is
pretty good at "optimizing" its processing.

Still, my statement stands that I think you'd need a good many thousands of
repetitions to see a measurable difference in performance or response, and
it is the kind of thing that isn't done in a loop-of-thousands-of-times, but
in onesies or fewsies. Thus I think that arguing it as though it were a
significant, if not vital, issue is just plain silly.

Larry Linson
Microsoft Access MVP
 
Larry Linson said:
Yes, that is the case, and is why I normally use the "." these days.
David, however, is absolutely correct that "." is not usable between the
name of a recordset and the name of a field in that recordset.

You can use rs.Fields("MyField").Value, although there is no advantage in
this case really because ! is just a shortcut for Fields("MyField").
However, I have never seen documentation of the steps you describe, and as
Microsoft is reluctant to disclose details of internals, wonder if you are
simply assuming that is what happens, if you have an inside source at
Redmond, or if the steps are, in fact, documented.

It's fairly well documented that ! is simply a shortcut for accessing items
in a collection by name so in the case of the form it will be accessing the
controls collection.
In many cases, Access is pretty good at "optimizing" its processing.

That is possible although I don't see the reason to write less efficient
code and rely on it being optimised when there is no advantage in using the
less efficient method. You also don't know if the optimisation happens or
not.
Still, my statement stands that I think you'd need a good many thousands
of repetitions to see a measurable difference in performance or response,
and it is the kind of thing that isn't done in a
loop-of-thousands-of-times, but in onesies or fewsies. Thus I think that
arguing it as though it were a significant, if not vital, issue is just
plain silly.

Maybe so but if the difference is typing ! or . and one is more efficient
then why not use it?

But you've skipped over the most important points that intellisense doesn't
work and the compiler can pick up errors. This second point is especially
important. Try this code in a form (assuming the form has a textbox called
MyTextBox):

Private Sub DoSomething1
Me.MyTextBxo.Valeu = "555"
End Sub
Private Sub DoSomething2
Me!MyTextBxo.Valeu = "555"
End Sub

Then push compile all modules. The mispelling in MyTextBox will be found in
DoSomething1. Then when that is fixed the misspelling of Value will be
found. On the other hand the errors in DoSomething2 will be missed
completely until runtime. If this is buried 10 levels deep in If statements
it might get passed testing.

Michael
 
Michael said:
But you've skipped over the most important points that intellisense
doesn't work and the compiler can pick up errors. This second point
is especially important. Try this code in a form (assuming the form
has a textbox called MyTextBox):

You can get intellisense by hitting Ctrl-spacebar. By using that you won't
have any misspellings.
 
Joan Wild said:
You can get intellisense by hitting Ctrl-spacebar. By using that you
won't have any misspellings.

Not if you use ! instead of . Intellisense won't work because everything is
late bound.

Michael
 
Michael C said:
You can use rs.Fields("MyField").Value, although
there is no advantage in this case really because ! is
just a shortcut for Fields("MyField").

What you cite is _not_ using a "." between the name of the Recordset and the
name of the Field -- it is using a cumbersome and unnecessary structure
instead of a simple one that takes advantage of the default Collection.

rs!MyField is a much simpler "shortcut."
It's fairly well documented that ! is simply a
shortcut for accessing items in a collection by
name so in the case of the form it will be
accessing the controls collection.

If I understand correctly, you do _not_ have documentation nor inside
knowledge that exactly those or that all those steps are performed but you
are only assuming that they are.
That is possible although I don't see the reason to
write less efficient code and rely on it being optimised
when there is no advantage in using the less efficient
method. You also don't know if the optimisation
happens or not.

And, you've indicated that you don't know if all those steps are performed,
either, but you _assume_ they are.
Maybe so but if the difference is typing ! or . and
one is more efficient then why not use it?

The fact is that the increase in efficiency is inconsequential, if it exists
at all.
But you've skipped over the most important
points that intellisense doesn't work and the
compiler can pick up errors. This second point
is especially important. Try this code in a form

Not at all. I said that I normally use "." referring to Controls in a Form
or Report, because of Intellisense (and that is the first thing quoted in
this post).

But, Intellisense is not the subect of the discussion; the subject of
discussion is your claims about efficiency and inefficiency, all based on
your assumption of what "must" happen.

Larry Linson
Microsoft Access MVP
 
Larry Linson said:
What you cite is _not_ using a "." between the name of the Recordset and
the name of the Field -- it is using a cumbersome and unnecessary
structure instead of a simple one that takes advantage of the default
Collection.

I never said it was the exact same thing. I was just pointing out it is
possible to avoid using ! if you want to.
rs!MyField is a much simpler "shortcut."

What part of my statement "! is just a shortcut for Fields("MyField")."
didn't you understand? :-)
If I understand correctly, you do _not_ have documentation nor inside
knowledge that exactly those or that all those steps are performed but you
are only assuming that they are.

No I don't although speed tests show dot to be twice as fast, so while !
might be optimised to some degree it is still significantly less efficient.
But, Intellisense is not the subect of the discussion; the subject of
discussion is your claims about efficiency and inefficiency, all based on
your assumption of what "must" happen.

Inefficient is a broad term and I was using it very generally. I would
describe having the compiler miss errors as inefficient in terms of
developer time. The compile time issue is pretty much the "nail in the
coffin" for ! as far as I can see. (which I guess is why you're so keen for
them to not be part of this discussion :-) Does *any* reason exist to use it
for controls?

Michael
 
I never said it was the exact same thing. I was just pointing out it is
possible to avoid using ! if you want to.


What part of my statement "! is just a shortcut for Fields("MyField")."
didn't you understand? :-)

Since you are big on "understanding," I'm sure you can understand that your
condescending and argumentative attitude is why I choose to terminate this
discussion with you.

Larry
 
Larry Linson said:
Since you are big on "understanding," I'm sure you can understand that
your condescending and argumentative attitude is why I choose to terminate
this discussion with you.

I suspect it has more to do with you being at the end of that plank you've
backed yourself onto :-)

Michael
 
Back
Top