They both refer to the same object, just getting it from different places.
When you use the dot syntax, you're referring to TextBox as a property of
the form, whereas using the bang syntax obtains TextBox from the form's
Controls collection.
Technically, the difference is that Form.TextBox is resolved at compile-time
whereas Form!TextBox is resolved at runtime (ie once the code has been
compiled and is executing).
I doubt you'll ever see a performance difference, so the choice is yours...
They both refer to the same object, just getting it from different places.
When you use the dot syntax, you're referring to TextBox as a property of
the form, whereas using the bang syntax obtains TextBox from the form's
Controls collection.
Technically, the difference is that Form.TextBox is resolved at
compile-time whereas Form!TextBox is resolved at runtime (ie once the code
has been compiled and is executing).
I doubt you'll ever see a performance difference, so the choice is
yours...
And if you really want more detail than the practical summary Stuart
provided, you can read further here: http://advisor.com/doc/05352
My personal preference is to use the dot when referring to controls,
precisely because misspellings are caught at compile time. I don't use the
dot to refer directly to field names in the form's recordset, because that
can fail. (Access seems to handle these objects of type AccessField
inconsistently.)
And if you really want more detail than the practical summary Stuart
provided, you can read further here: http://advisor.com/doc/05352
My personal preference is to use the dot when referring to controls,
precisely because misspellings are caught at compile time. I don't use the
dot to refer directly to field names in the form's recordset, because that
can fail. (Access seems to handle these objects of type AccessField
inconsistently.)
Andy Baron - now there's a name I haven't seen in a while. I can remember
him advocating use of only the bang syntax at one time, back on the
Compuserve msaccess forum. Good to see he adapts as discoveries are made.
Respect.
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.