What is wrong with this Microsoft Access query?
Consider this Access query:
SELECT prod_Parts.ID, prod_Parts.Number, prod_Parts.Revision, prod_Parts.Description
FROM prod_JT_Shipping
INNER JOIN (prod_JobTraveller
INNER JOIN prod_Parts
开发者_高级运维 ON prod_JobTraveller.PartID = prod_Parts.ID)
ON prod_JT_Shipping.JT_ID=prod_JobTraveller.ID;
Also this:
SELECT prod_Parts.ID, prod_Parts.Number, prod_Parts.Revision, prod_Parts.Description
FROM prod_Parts;
This error occurs on both:
'is not a valid name. Make sure that it does not include invalid characters or punctuation and that it is not too long
How can this be fixed?
Judging from the error message, you have some invisible control character in the query, that is causing the problem.
Try to retyping the query from scratch, and it will most likely work.
Side note: I find it easier to follow the joins if they are written in this order (i.e. with the ON clause directly following each JOIN):
SELECT
prod_Parts.ID, prod_Parts.Number, prod_Parts.Revision, prod_Parts.Description
FROM
(
prod_JT_Shipping
INNER JOIN prod_JobTraveller ON prod_JT_Shipping.JT_ID=prod_JobTraveller.ID
)
INNER JOIN prod_Parts ON prod_JobTraveller.PartID = prod_Parts.ID
This part here doesn't look right:
INNER JOIN (prod_JobTraveller
INNER JOIN prod_Parts ON prod_JobTraveller.PartID = prod_Parts.ID)
If you consolidate that without whitespace it looks like
INNER JOIN (prod_JobTraveller INNER JOIN prod_Parts ON prod_JobTraveller.PartID = prod_Parts.ID)
Which is not valid SQL.
OK. I have simplified query:
SELECT prod_Parts.ID, prod_Parts.Number, prod_Parts.Revision, prod_Parts.Description FROM prod_Parts;
The same error :)
精彩评论