Solved

Access Query Expression too complex in query expression

Posted on 2009-04-14
7
498 Views
Last Modified: 2013-11-29
I have this query that I'm building that keeps giving me the Expression too complex in query expression. Attached is the SQL code are there too many columns involved? Is there a way to get around this?

SELECT fld_JobID,ID, Sum(Nz([fld_DHBidPrep])+(Nz([fld_DHHeadBreakdown])+(Nz([fld_DHRebid])+(Nz([fld_DHWACADSetUP])+(Nz([fld_DHHBCADSetUp])+(Nz([fld_DHPrepWork])+(Nz([fld_DHRFIDetails])+(Nz([fld_DHApartmentHeadLayout])+(Nz([fld_DHAptPipeLayoutSchedule])+(Nz([fld_DHGarageHeadLayout])+(Nz([fld_DHGarPipeLayoutSchedule])+(Nz([fld_DHStandpipes])+(Nz([fld_DHRFIs])+(Nz([fld_DHCalcTime])+(Nz([fld_DHStocklisting])+(Nz([fld_DHSitePlan])+(Nz([fld_GeneralNotes])+(Nz([fld_DHSwayBrace])+(Nz([fld_DHInsertsCanoutsTags])+(Nz([fld_DHCleanUp])+(Nz([fld_DHPlanCheck])+(Nz([fld_DHTainingPeerReview])+(Nz([fld_ChangeOrder])+(Nz([fld_As-Builts]))))))))))))))))))))))))) AS DHDesignHoursTotalsByID
FROM tbl_DesignHours
GROUP BY fld_JobID;

Open in new window

0
Comment
Question by:Bill Warren
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 15

Expert Comment

by:MNelson831
ID: 24142410
You left out half of the NZ() statements so the query thinks you are trying to do MANY nested if null then loops.

try this instead:

SELECT
      fld_JobID,
      ID,
      Sum(Nz([fld_DHBidPrep],0)+Nz([fld_DHHeadBreakdown],0)+Nz([fld_DHRebid],0)+Nz([fld_DHWACADSetUP],0)+Nz([fld_DHHBCADSetUp],0)+Nz([fld_DHPrepWork],0)+Nz([fld_DHRFIDetails],0)+Nz([fld_DHApartmentHeadLayout],0)+Nz([fld_DHAptPipeLayoutSchedule],0)+Nz([fld_DHGarageHeadLayout],0)+Nz([fld_DHGarPipeLayoutSchedule],0)+Nz([fld_DHStandpipes],0)+Nz([fld_DHRFIs],0)+Nz([fld_DHCalcTime],0)+Nz([fld_DHStocklisting],0)+Nz([fld_DHSitePlan],0)+Nz([fld_GeneralNotes],0)+Nz([fld_DHSwayBrace],0)+Nz([fld_DHInsertsCanoutsTags],0)+Nz([fld_DHCleanUp],0)+Nz([fld_DHPlanCheck],0)+Nz([fld_DHTainingPeerReview],0)+Nz([fld_ChangeOrder],0)+Nz([fld_As-Builts],0) AS DHDesignHoursTotalsByID
FROM tbl_DesignHours
GROUP BY fld_JobID;
0
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 500 total points
ID: 24142437
try this


SELECT fld_JobID,ID, Sum(
Nz([fld_DHBidPrep])+
Nz([fld_DHHeadBreakdown])+
Nz([fld_DHRebid])+
Nz([fld_DHWACADSetUP])+
Nz([fld_DHHBCADSetUp])+
Nz([fld_DHPrepWork])+
Nz([fld_DHRFIDetails])+
Nz([fld_DHApartmentHeadLayout])+
Nz([fld_DHAptPipeLayoutSchedule])+
Nz([fld_DHGarageHeadLayout])+
Nz([fld_DHGarPipeLayoutSchedule])+
Nz([fld_DHStandpipes])+
Nz([fld_DHRFIs])+
Nz([fld_DHCalcTime])+
Nz([fld_DHStocklisting])+
Nz([fld_DHSitePlan])+
Nz([fld_GeneralNotes])+
Nz([fld_DHSwayBrace])+
Nz([fld_DHInsertsCanoutsTags])+
Nz([fld_DHCleanUp])+
Nz([fld_DHPlanCheck])+
Nz([fld_DHTainingPeerReview])+
Nz([fld_ChangeOrder])+
Nz([fld_As-Builts]))
 AS DHDesignHoursTotalsByID
FROM tbl_DesignHours
GROUP BY fld_JobID;

Open in new window

0
 

Author Comment

by:Bill Warren
ID: 24142444
That is teling me Syntax Error (missing operator) in query expression
0
Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

 
LVL 44

Expert Comment

by:GRayL
ID: 24142466
I think it should look like this:

SELECT fld_JobID,ID, Sum(
Nz([fld_DHBidPrep],0)+
Nz([fld_DHHeadBreakdown],0)+
Nz([fld_DHRebid],0)+
Nz([fld_DHWACADSetUP],0)+
Nz([fld_DHHBCADSetUp],0)+
Nz([fld_DHPrepWork],0)+
Nz(fld_DHRFIDetails],0)+
Nz([fld_DHApartmentHeadLayout],0)+
Nz([fld_DHAptPipeLayoutSchedule],0)+
Nz([fld_DHGarageHeadLayout],0)+
Nz([fld_DHGarPipeLayoutSchedule],0)+
Nz([fld_DHStandpipes],0)+
Nz([fld_DHRFIs],0)+
Nz([fld_DHCalcTime],0)+
Nz([fld_DHStocklisting],0)+
Nz([fld_DHSitePlan],0)+
Nz([fld_GeneralNotes],0)+
Nz([fld_DHSwayBrace],0)+
Nz([fld_DHInsertsCanoutsTags],0)+
Nz([fld_DHCleanUp],0)+
Nz([fld_DHPlanCheck],0)+
Nz([fld_DHTainingPeerReview],0)+
Nz([fld_ChangeOrder],0)+
Nz([fld_As-Builts],0)) AS DHDesignHoursTotalsByID
FROM tbl_DesignHours
GROUP BY fld_JobID;
0
 

Author Closing Comment

by:Bill Warren
ID: 31570151
Thanks it worked great
0
 
LVL 15

Expert Comment

by:MNelson831
ID: 24142557
My bad.  Brain fart between nz in Access and IsNull in SQL
0
 

Author Comment

by:Bill Warren
ID: 24142571
Thanks anyway... still learning alot from the help from all.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
MS ACCESS VBA FORMATTING 9 63
SUBFORM on ACCESS 2013 8 35
ISeries Remote Location Route entry 2 25
Outlook mail to Access 8 25
In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question