var sidebar_align = 'right';
var content_container_margin = parseInt('290px');
var sidebar_width = parseInt('270px');
Unanswered: Running a query on a query?
I'm trying to figure out why Access won't let me run a query (query1) on another query(query2).
Query1 worked for the table that query2 is based on.
All query2 is is a 2 tables joined together (Product Information table Joined with the Customer table).
But every time I try and run it, I get an error in the FROM clause.
"Syntax error in FROM clause"
Anyone know why this is? I know I've ran queries on other queries before and it ran so this is quite confusing.
Hard to say without seeing the SQL of the query.
SELECT month(EndDate) AS [Month], year(EndDate) AS [Year]
WHERE month(EndDate)=[Enter Month] And year(EndDate)=[Enter Year];
I get that error from this.
This is what query2 is composed of
SELECT tblCustomer.Company, tblCustomer.FirstName, tblCustomer.LastName, tblCustomer.Phone, tblCustomer.Email, tblProducts.User, tblProducts.Product, tblProducts.StartDate, tblProducts.EndDate, tblProducts.AmountPaid, tblProducts.Comments
FROM tblCustomer INNER JOIN tblProducts ON tblCustomer.ID=tblProducts.ContactID;
query2 runs without error on its own? I don't see anything wrong with that SQL. Can you post the db here?
Yes query2 runs fine on its own without error.
And yes it looks good to me which is why it's so confusing.
And here it is.
query2 is called qrySubByCompany(raw) (Slightly abbreviated)
query1 is called qryEndDate
The query currently has the table in place of the query just to show you that it works. But when you replace it with query 2, you get the error.
qryEndDate runs without error for me. After prompting for month and year, it displays a record. It still runs if I change the source to the query instead of the table.
Really? What the hell is going on then? Can you reupload that database for me then?
You think there might be a discrepancy with the versions of Access we're using? Because I'm using Office 2007.
That's really weird.
I figured it out, I needed to place square brackets,  around the query.