Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

..Expression too complex to be evaluated error in SQL

Status
Not open for further replies.

azalealee

Programmer
Nov 21, 2002
36
0
0
AU
Hi

I'm having troubles with this query. Everything works fine with the option group selecting the right records from the table. However, I get the error "..expression too complex to be evaluated" when I include the criteria after the final AND. This criteria checks to see if the first selection from the combo box was chosen, if true then have nothing in the criteria. If false, then select all records for the Relevant_Leader.

Any help would be appreciated, thanks!

SELECT M_HASIFDB.Relevant_Leader, M_HASIFDB.Date_Reported, M_HASIFDB.Originator, M_HASIFDB.Description, M_HASIFDB.Originator_Action, M_HASIFDB.Date_Entered, M_HASIFDB.Category, M_HASIFDB.Leader_Urgency, M_HASIFDB.Leader_Action, M_HASIFDB.Target_Date, M_HASIFDB.Date_Completed, M_HASIFDB.MRC_Reviewed, M_HASIFDB.Date_Reviewed, M_HASIFDB.HASIF_ID
FROM M_HASIFDB
WHERE (((IIf([Forms]![F_ReportsMenu]![Filter_Op_Group]=1,([M_HASIFDB].[Date_Completed]) Is Null,IIf([Forms]![F_ReportsMenu]![Filter_Op_Group]=2,([M_HASIFDB].[Date_Completed]) Is Not Null,IIf([Forms]![F_ReportsMenu]![Filter_Op_Group]=3,([M_HASIFDB].[MRC_Reviewed])=False,([M_HASIFDB].[Date_Entered]) Between [Forms]![F_ReportsMenu]![FromDate] And [Forms]![F_ReportsMenu]![ToDate]))))<>False) AND (([Forms]![F_ReportsMenu]![LeaderCbo_GenericReport])=IIf([Forms]![F_ReportsMenu]![LeaderCbo_GenericReport]=0,0,[Relevant_Leader])));
 
hi1

divide the query like this:

ssql = &quot; SELECT M_HASIFDB.Relevant_Leader, M_HASIFDB.Date_Reported, M_HASIFDB.Originator, M_HASIFDB.Description, M_HASIFDB.Originator_Action, M_HASIFDB.Date_Entered, M_HASIFDB.Category, M_HASIFDB.Leader_Urgency, M_HASIFDB.Leader_Action, M_HASIFDB.Target_Date, &quot;


ssql = ssql & &quot; M_HASIFDB.Date_Completed, M_HASIFDB.MRC_Reviewed, M_HASIFDB.Date_Reviewed, M_HASIFDB.HASIF_ID
FROM M_HASIFDB &quot;

and so on if there is no mistake inside the query it should work.
good luck
poky
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top