help with subselect

F

Fredrated

The following query executes:
SELECT ProjectNumber AS ProjectCode, Project.ProjectName, DE.ID AS DataID,
Project.ProjectID, DE.EmployeeID, DE.[1], DE.[2], DE.[3], DE.[4], DE.[5],
DE.[6], DE.[7], DE.[8], DE.[9], DE.[10], DE.[11], DE.[12], DE.[13], DE.[14],
DE.[15], DE.[16], DE.[17], DE.[18], DE.[19], DE.[20], DE.[21], DE.[22],
DE.[23], DE.[24], DE.[25], DE.[26], DE.[27], DE.[28], DE.[29], DE.[30],
DE.[31], DE.[32], DE.[33], DE.[34], DE.[35], DE.[36], DE.[37] FROM DE INNER
JOIN Project ON DE.ProjectID = Project.ProjectID;

However, when attempting to make this a sub-select query, the following
results in an error:
SELECT Q.* FROM
[SELECT ProjectNumber AS ProjectCode, Project.ProjectName, DE.ID AS DataID,
Project.ProjectID, DE.EmployeeID, DE.[1], DE.[2], DE.[3], DE.[4], DE.[5],
DE.[6], DE.[7], DE.[8], DE.[9], DE.[10], DE.[11], DE.[12], DE.[13], DE.[14],
DE.[15], DE.[16], DE.[17], DE.[18], DE.[19], DE.[20], DE.[21], DE.[22],
DE.[23], DE.[24], DE.[25], DE.[26], DE.[27], DE.[28], DE.[29], DE.[30],
DE.[31], DE.[32], DE.[33], DE.[34], DE.[35], DE.[36], DE.[37] FROM DE INNER
JOIN Project ON DE.ProjectID = Project.ProjectID]. AS Q;

The error is
Invalid bracketing of name 'SELECT ProjectNumber as ProjectCode,
Project.ProhectName, DE.ID as DataID, Project.ProjectID, DE.EmployeeID,
DE.[1'.

and after clicking [OK], the query statement if highlighted from SELECT Q.*
to
the DE. of DE.EmployeeID.

Any ideas?

Thanks, Fred
 
F

Fredrated

The field names in the table DE are 1, 2, 3, etc.
When referencing them in queries, Access places the brackets, ex. [1],
around them to avoid confusion. These brackets are disrupting the subselect.
When I rename them DE.a1, DE.a2 etc, the subselect query works properly.
 
J

Jeff Boyce

I'm having trouble understanding a relational database table structure with
columns named "1", "2", ...

Moreover, it is pretty unusual to have a well-normalized relational database
table with that many (?37+) columns.

If you'll provide a bit more specific description of what you are working
with, folks here may be able to offer more specific suggestions for how you
can get better use of Access' relationally-oriented features & functions.


Regards

Jeff Boyce
Microsoft Office/Access MVP
 

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.

Ask a Question

Top