If you're going to be porting to other database systems as you
implied in the other post, then use periods instead of the
exclamation points, which are more of a VBA artifact.
If you do have references to form objects in your queries, you need
to be aware that those form objects will not be in the scope of the
remote database when used in a passthrough query, so errors will
result. You will need to use VBA to replace the reference to the
form object in the query's SQL property with the actual value of the
form object before running the query.
Phil Smith wrote:
Thanks. So is there really no difference between period and
exclamation point, just an aesthetics/visibility issue? Because
Access seems to use it a lot in table. field combinations, and other
SQL engines don't seem to appreciate it...
I am running into some significant speed issues on some reports, and
am beginning to change some of the queries to passthrough queries.
It is not as simple as I would have hoped to convert these over.
Learning a lot though...
Thanx
On 4/12/2010 12:27 PM, John Spencer wrote:
Brackets are used if the table name or field name is a reserved
word or contains any characters other than letters, numbers, and
the underscore.
Why? To avoid problems. Simple example: A field named x-y could be
interpreted as subtract y from x, so to make sure the the field is
understood as a field you enter [x-y] which tells the SQL engine
that this is a field.
Another simple example Date. Date is a function that returns the
current date, [Date] is a field.
Period versus Exclamation. The preferred method is to use the
period when separating table and field names. The only time I use
the ! is when I am referencing controls and not table and field
names.
John Spencer
Access MVP 2002-2005, 2007-2010
The Hilltop Institute
University of Maryland Baltimore County
Phil Smith wrote:
When I look at SQL versions of code created in design view, I see
many different ways of referencing fields in a table. Please
explain the differences and why to use what...
table.field