Solved

Access Query Expression too complex in query expression

Posted on 2009-04-14
7
499 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
Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

 
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

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

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

As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

615 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