472,791 Members | 1,315 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,791 software developers and data experts.

Report Error: Multi-Level GROUP BY clause is not allowed in a subquery

A2003. I am getting this error message when I try to set a report's
recordsource to an SQL statement or a saved querydef that uses sub-queries.

I've debug.printed the SQL, and run it as a stand alone query, as a
rowsource for a list box and as a recordsource for a form. There's no
problem. I'm only encountering this in reports.

As a stop gap, I'm going to use a form for a printe report, bvut I
wonder if anyone has encountered anything like this before? A2003's
help is useless on this - no error number is shown and pressing the help
button with a broadband connection produces absolutely nothing.

The SQL is rather lengthy, but here're a couple of field's expressions
copied straight from the querydesign grid that could, I suppose, be
considered "typical". Remember, this works beautifully in forms and
listboxes and run as a query. There are 12 similar sub queries in the
SQL - they are drawing information from mainly a large transaction table
that contains many types of transactions (lots of fields) which are
either 0 or some value:

Square: IIf([Carried by]="Not Mounted",nz((Select top 1 ORD_SQUARE from
TBL_TURN_ORDERS as S where S.ORD_UNT_FK = A.UNT_PK and ((ORD_CONFIRM = 1
and ORD_TURN < 1) or ORD_TURN = 1) order by ord_sequence desc),"Not
Placed"),"-")

Sp Av: [UTY_SUP_CAP]+nz((select sum(ORD_SUP_COST) from TBL_TURN_ORDERS
as S where S.ORD_UNT_FK = A.UNT_PK and ((ORD_CONFIRM = 1 AND ORD_TURN <
1) or ORD_TURN = 1)),0)

Carried by: IIf(nz((select top 1 ORD_TRANSPORT from TBL_TURN_ORDERS as S
where S.ORD_UNT_FK = A.UNT_PK and ORD_TRANSPORT <> 0 and
ORD_TRANS_UNT_FK <> 0 and ((S.ORD_TURN < 1 and S.ORD_CONFIRM = -1) or
S.ORD_TURN = 1) Order by ORD_SEQUENCE desc),-1)=-1,"Not Mounted",(SELECT
top 1 UNT_CODE FROM TBL_TURN_ORDERS as S INNER JOIN TBL_UNITS as U ON
S.ORD_TRANS_UNT_FK = U.UNT_PK where S.ORD_TRANSPORT = 1 AND
S.ORD_UNT_FK = A.UNT_PK AND ((S.ORD_TURN < 1 AND S.ORD_CONFIRM = 1) or
(S.ORD_TURN = 1)) order by ord_sequence desc))
--
Tim http://www.ucs.mun.ca/~tmarshal/
^o<
/#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake
/^^ "Whatcha doin?" - Ditto "TIM-MAY!!" - Me
Nov 13 '05 #1
1 7126
Yes, Tim, it's very easy to get this error.

It seems that the reporter is creating another query into your query, to
handle the things specified in the Sorting'n'Grouping dialog. If there is
nothing there, the query with subquery works fine, but if it has to group
further, it spits the dummy with this "multi-level GROUP BY" message.

Since you generally can't avoid the grouping at the report level, the
workaround is generally to change the source query. You might be able to use
stacked queries instead of subqueries (i.e. a query that uses another query
as a source "table".) And you might even be able to get away with including
the subquery in the lower level query.

You may have also found that it's fairly easy to crash Access using
subqueries ("shut down by Windows... Sorry for inconvenience"). While
subqueries are very useful, JET's implementation of them is somewhat
lacking.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Tim Marshall" <TI****@PurplePandaChasers.Moertherium> wrote in message
news:da**********@coranto.ucs.mun.ca...
A2003. I am getting this error message when I try to set a report's
recordsource to an SQL statement or a saved querydef that uses
sub-queries.

I've debug.printed the SQL, and run it as a stand alone query, as a
rowsource for a list box and as a recordsource for a form. There's no
problem. I'm only encountering this in reports.

As a stop gap, I'm going to use a form for a printe report, bvut I wonder
if anyone has encountered anything like this before? A2003's help is
useless on this - no error number is shown and pressing the help button
with a broadband connection produces absolutely nothing.

The SQL is rather lengthy, but here're a couple of field's expressions
copied straight from the querydesign grid that could, I suppose, be
considered "typical". Remember, this works beautifully in forms and
listboxes and run as a query. There are 12 similar sub queries in the
SQL - they are drawing information from mainly a large transaction table
that contains many types of transactions (lots of fields) which are either
0 or some value:

Square: IIf([Carried by]="Not Mounted",nz((Select top 1 ORD_SQUARE from
TBL_TURN_ORDERS as S where S.ORD_UNT_FK = A.UNT_PK and ((ORD_CONFIRM = 1
and ORD_TURN < 1) or ORD_TURN = 1) order by ord_sequence desc),"Not
Placed"),"-")

Sp Av: [UTY_SUP_CAP]+nz((select sum(ORD_SUP_COST) from TBL_TURN_ORDERS as
S where S.ORD_UNT_FK = A.UNT_PK and ((ORD_CONFIRM = 1 AND ORD_TURN < 1) or
ORD_TURN = 1)),0)

Carried by: IIf(nz((select top 1 ORD_TRANSPORT from TBL_TURN_ORDERS as S
where S.ORD_UNT_FK = A.UNT_PK and ORD_TRANSPORT <> 0 and ORD_TRANS_UNT_FK
<> 0 and ((S.ORD_TURN < 1 and S.ORD_CONFIRM = -1) or S.ORD_TURN = 1)
Order by ORD_SEQUENCE desc),-1)=-1,"Not Mounted",(SELECT top 1 UNT_CODE
FROM TBL_TURN_ORDERS as S INNER JOIN TBL_UNITS as U ON S.ORD_TRANS_UNT_FK
= U.UNT_PK where S.ORD_TRANSPORT = 1 AND S.ORD_UNT_FK = A.UNT_PK AND
((S.ORD_TURN < 1 AND S.ORD_CONFIRM = 1) or (S.ORD_TURN = 1)) order by
ord_sequence desc))

Nov 13 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: deko | last post by:
I can't move a multi-page report to the last record unless I keep the popup form (that defined it's subreports) open. DoCmd.OpenReport "rptStandard", acViewNormal DoCmd.Close acForm,...
5
by: Terri | last post by:
I have a form with a multi-select combo. I dynamically build a SELECT statement, open a report, and set the recordsource to my dynamic SELECT statement. I count the records returned in the report...
5
by: dkelly925 | last post by:
Is there a way to add an If Statement to the following code so if data in a field equals "x" it will launch one report and if it equals "y" it would open another report. Anyone know how to modify...
2
by: Arnold | last post by:
Greetings Gurus, In a report showing the names of students and their progress, I am getting an error in the name field (Name: #Error). The report gets its data from an unbound form containing...
0
by: klconklin | last post by:
I have a WAN network w/ Multi Web server hosting "Internal XML files" of the branch office proprietary app XML reports on each branches web server, I would like to be able to host on the Main...
13
by: Greg | last post by:
Most suggestions on this topic recommend to use a page footer and make it visible only on the last page. My problem is that the footer is half of the height of a page which means the detail would...
1
by: Intrepid_Yellow | last post by:
Hi, I have the following code that runs my report generator. The user selects a table from a combo box, then whatever fields they want from a list box. (This part all works and the report runs...
4
by: Fran | last post by:
I recently tried to use code for "Use a multi-select list box to filter a report" from Allen Browne in my database. I was able to add the code and adapt it to my needs, however I am getting an...
1
by: freetime | last post by:
Greetings, This is my first post so I will try to be brief and accurate. I have a report that uses 9 user selectable filters (Dates, Y/N's as Combo Boxes and 4 Multi-Select List Boxes. ...
12
by: micarl | last post by:
How would i print a report based on criteria selected from several Combo Boxes as well as multiple Multi Select List Boxes, that are located on the same form? I can get one Multi List Box, just...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
linyimin
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
0
by: erikbower65 | last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA: 1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Sept 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
14
DJRhino1175
by: DJRhino1175 | last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this - If...
0
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
5
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.