Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Access Query Expression too complex in query expression

Posted on 2009-04-14
7
Medium Priority
?
501 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 2000 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
Technology Partners: 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!

 
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

New benefit for Premium Members - Upgrade now!

Ready to get started with anonymous questions today? It's easy! Learn more.

Question has a verified solution.

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

This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
If you need a simple but flexible process for maintaining an audit trail of who created, edited, or deleted data from a table, or multiple tables, and you can do all of your work from within a form, this simple Audit Log will work for you.
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

688 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