Reserved error (-3011)

B

BobRoyAce

I inherited a database and need to make some changes to some queries. The
table and field names are crazy (include spaces, etc.), but I have nothing
to do with that. So, the issue is that when I modified a query to get what's
shown below, and I attempt to execute it, I get the following error message:

Reserved error (-3011); there is no message for this error.

All I did was add the ORDER BY clause. Without that the query runs but I get
records back in wrong order. What is wrong with this query?

------- QUERY BEGINS -------

SELECT TableA.[Month Name], (100*(TableB.[SumOfTotal
Production]/TableB.[SumOfTotal Capacity])) AS Efficiency
FROM TableA INNER JOIN (MonthData
INNER JOIN TableB ON MonthData.[System Month Number] = TableB.[System Month
Number])
ON TableA.[Month Order] = MonthData.[Fiscal Month Number]
GROUP BY TableA.[Month Name], (100*([SumOfTotal Production]/[SumOfTotal
Capacity])), TableB.[Fiscal Year]
HAVING TableB.[Fiscal Year]=2004
ORDER BY MonthData.[Fiscal Month Number]

------- QUERY ENDS -------
 
G

Gary Walter

BobRoyAce said:
I inherited a database and need to make some changes to some queries. The
table and field names are crazy (include spaces, etc.), but I have nothing
to do with that. So, the issue is that when I modified a query to get what's
shown below, and I attempt to execute it, I get the following error message:

Reserved error (-3011); there is no message for this error.

All I did was add the ORDER BY clause. Without that the query runs but I get
records back in wrong order. What is wrong with this query?

------- QUERY BEGINS -------

SELECT TableA.[Month Name], (100*(TableB.[SumOfTotal
Production]/TableB.[SumOfTotal Capacity])) AS Efficiency
FROM TableA INNER JOIN (MonthData
INNER JOIN TableB ON MonthData.[System Month Number] = TableB.[System Month
Number])
ON TableA.[Month Order] = MonthData.[Fiscal Month Number]
GROUP BY TableA.[Month Name], (100*([SumOfTotal Production]/[SumOfTotal
Capacity])), TableB.[Fiscal Year]
HAVING TableB.[Fiscal Year]=2004
ORDER BY MonthData.[Fiscal Month Number]

------- QUERY ENDS -------
Hi Bob,

Best guess:

When you create a group with your 3 current selections,
in each group, will [Fiscal Month Number] be distinct?
It makes sense to me that they would be, but it wouldn't
hurt to check.

Add it twice to the grid and set one to MAX and
other to MIN.

If they are the same, then keep one and sort on it
and see if you still get error.

Just guessing,

Gary Walter
 

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