B
BillA
Hello:
I have a Query that is used to support a read-only continuous form.
I am trying to include a Comments section in this form where only the most
recent comment is shown.
It was suggested through this forum to develop a SUBQUERY within the main
query to provide the data I seek.
I’ve been having difficulty with this subquery and hope to get a little help.
This is what I am working with in creating my subquery:
Tables
lk_Reviews tbl_Reviewer
ReviewID (pk) ReviewerID (pk)
ProjectID (fk) ...
CommentDate LastName
Comments (etc...)
ReviewerID (fk)
(ProjectID foreign key is included in the main query)
I would like to include these fields in my subquery:
lk_Reviews.CommentDate
tbl_Reviewer.LastName
lk_Reviews.Comments
This is what I have thus far… and it’s not working:
Comment: (SELECT lk_Reviews.CommentDate, tbl_reviewer.LastName,
lk_Reviews.Comments FROM tbl_reviewer RIGHT JOIN lk_Reviews ON
tbl_reviewer.ReviewerID = lk_Reviews.ReviewerID WHERE lk_Reviews.ProjectID =
tbl_Project.ProjectID ORDER BY lk_Reviews.CommentDate DESC,
tbl_review.ReviewID)
I am getting this error message:
“You have written a subquery that can return more than one field without
using the EXISTS reserved word in the main query's FROM clause. Revise the
SELECT statement of the subquery to request only one field. (Error 3306)â€
I’m not even sure I’ve built a proper subquery for my needs; this error put
me over the edge. Any advice or help would be greatly appreciated.
Bill
I have a Query that is used to support a read-only continuous form.
I am trying to include a Comments section in this form where only the most
recent comment is shown.
It was suggested through this forum to develop a SUBQUERY within the main
query to provide the data I seek.
I’ve been having difficulty with this subquery and hope to get a little help.
This is what I am working with in creating my subquery:
Tables
lk_Reviews tbl_Reviewer
ReviewID (pk) ReviewerID (pk)
ProjectID (fk) ...
CommentDate LastName
Comments (etc...)
ReviewerID (fk)
(ProjectID foreign key is included in the main query)
I would like to include these fields in my subquery:
lk_Reviews.CommentDate
tbl_Reviewer.LastName
lk_Reviews.Comments
This is what I have thus far… and it’s not working:
Comment: (SELECT lk_Reviews.CommentDate, tbl_reviewer.LastName,
lk_Reviews.Comments FROM tbl_reviewer RIGHT JOIN lk_Reviews ON
tbl_reviewer.ReviewerID = lk_Reviews.ReviewerID WHERE lk_Reviews.ProjectID =
tbl_Project.ProjectID ORDER BY lk_Reviews.CommentDate DESC,
tbl_review.ReviewID)
I am getting this error message:
“You have written a subquery that can return more than one field without
using the EXISTS reserved word in the main query's FROM clause. Revise the
SELECT statement of the subquery to request only one field. (Error 3306)â€
I’m not even sure I’ve built a proper subquery for my needs; this error put
me over the edge. Any advice or help would be greatly appreciated.
Bill