Double definition

  • Thread starter Thread starter H. Martins
  • Start date Start date
H

H. Martins

In a query like this:

strSelectA = "SELECT tblTurmaMatriz.lintTurmaMatrizKMaster FROM
tblTurmaMatriz WHERE tblTurmaMatriz.lintTurmaMatrizKMaster = " &
RecIndex

Something puzzles me. It it is said that the SELECT it is "FROM
tblTurmaMatriz" why does the SELECT has to include "tblTurmaMatriz" in
"tblTurmaMatriz.lintTurmaMatrizKMaster"?

Couldn't it be just SELECT lintTurmaMatrizKMaster FROM tblTurmaMatriz
WHERE ...

Thanks
 
H. Martins said:
In a query like this:

strSelectA = "SELECT tblTurmaMatriz.lintTurmaMatrizKMaster FROM
tblTurmaMatriz WHERE tblTurmaMatriz.lintTurmaMatrizKMaster = " &
RecIndex

Something puzzles me. It it is said that the SELECT it is "FROM
tblTurmaMatriz" why does the SELECT has to include "tblTurmaMatriz" in
"tblTurmaMatriz.lintTurmaMatrizKMaster"?

Couldn't it be just SELECT lintTurmaMatrizKMaster FROM tblTurmaMatriz
WHERE ...

Thanks

That's called disambiguation, and its a Good Thing. Access includes the
table name in case you have a field in more than one of the query's tables
with the same name (ID for instance - table1.ID is distinguished from
table2.ID)

My advice is to stop worrying about it. If it looks horrible, try using
shorter field and table names.
 
Something puzzles me. It it is said that the SELECT it is "FROM
tblTurmaMatriz" why does the SELECT has to include "tblTurmaMatriz" in
"tblTurmaMatriz.lintTurmaMatrizKMaster"?

It doesn't *have* to unless you have two tables which both have fields named
lintTurmaMatrizKMaster. That's unlikely of course <g> but another developer
might well have several tables all with a field named ID as the primary key -
perfectly legal, but doing so requires that you specify the table name in
order for Access to know *which* ID.

You can leave the tablename off or put it on as you prefer; I'll agree with
Stuart that it's good documentation to leave it on, but the query will work
correctly either way.
 
Back
Top