"Group by" causes "ODBC--Call Failed" error

kaledev

Registered User.
Local time
Today, 18:56
Joined
Jan 20, 2011
Messages
19
I have the following query that works perfectly:

Code:
SELECT [Q02 AUSTELL L/E].[Report Dt], [Q02 AUSTELL L/E].Terminal, [Q02 AUSTELL L/E].[L/E], Count([Q02 AUSTELL L/E].[L/E]) AS [Total Onhand Units], [View All Allotments].Allowed, Forms!MAIN!STARTDATE AS [Min Report Dt], Forms!MAIN!ENDDATE AS [Max Report Dt]
FROM [Q02 AUSTELL L/E] INNER JOIN [View All Allotments] ON [Q02 AUSTELL L/E].Terminal = [View All Allotments].TerminalName
GROUP BY [Q02 AUSTELL L/E].[Report Dt], [Q02 AUSTELL L/E].Terminal, [Q02 AUSTELL L/E].[L/E], [View All Allotments].Allowed;

I need to also group by the STARTDATE and ENDDATE fields in this query. When I add them in, as shown below, I get the error "ODBC--Call Failed". I am a bit confused about this one, any ideas? Just to let you know, the "View All Allotments" query is referencing a few SQL Server Linked tables inside of its query. But I don't see how these fields are causing a problem since they have nothing to do with it. Thanks!

Code:
SELECT [Q02 AUSTELL L/E].[Report Dt], [Q02 AUSTELL L/E].Terminal, [Q02 AUSTELL L/E].[L/E], Count([Q02 AUSTELL L/E].[L/E]) AS [Total Onhand Units], [View All Allotments].Allowed, Forms!MAIN!STARTDATE AS [Min Report Dt], Forms!MAIN!ENDDATE AS [Max Report Dt]
FROM [Q02 AUSTELL L/E] INNER JOIN [View All Allotments] ON [Q02 AUSTELL L/E].Terminal = [View All Allotments].TerminalName
GROUP BY [Q02 AUSTELL L/E].[Report Dt], [Q02 AUSTELL L/E].Terminal, [Q02 AUSTELL L/E].[L/E], [View All Allotments].Allowed, Forms!MAIN!STARTDATE, Forms!MAIN!ENDDATE;
 
The only way I could temp fix this was to append [View All Allotments] to a local table first...then everything works. This is similar to the "Query too complex" error I was recieving and had to fix the same way...no clue at all why this is happening when dealing with linked SQL Server tables...
 
Another way without having to use another table is to do the grouping on the query WITHOUT the form references and then use this query in another query and add them there as just another field without grouping. The dates would show up on the query just as if they were grouped.
 

Users who are viewing this thread

Back
Top Bottom