Re: IIf dilemma

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



John, Here is the SQL.....

SELECT [Eval Data - Instructor].LastName, [Eval Data - Instructor].Course,
[Eval Data - Instructor].Section, [Eval Data - Instructor].StartDate,
Class.Cost, Class.CostAdjust, Class.CurrentEnrollment,
IIf([State]="Delivery",([Cost]+[CostAdjust])*[CurrentEnrollment],([Cost]+[CostAdjust])*[CurrentEnrollment]/2) AS [Class Cost]
FROM Class INNER JOIN [Eval Data - Instructor] ON Class.Section = [Eval Data
- Instructor].Section
GROUP BY [Eval Data - Instructor].LastName, [Eval Data - Instructor].Course,
[Eval Data - Instructor].Section, [Eval Data - Instructor].StartDate,
Class.Cost, Class.CostAdjust, Class.CurrentEnrollment
ORDER BY [Eval Data - Instructor].LastName;

The error message I received is......"You tried to execute a query that did
not include the specified expression
'IIf([State]="Delivery",([Cost]+[CostAdjust])+[CurrentEnrollment],([Cost]+[CostAdjust])*[CurrentEnrollment]/2)' as part of an aggregate function"

Thank you for any assistance you can give me!!!

"John Spencer" wrote:

POST the SQL of the query you are having a problem with AND the text of
the error message.

(Menu: VIEW: SQL when in design view)

'====================================================
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
'====================================================


BCS wrote:
John - Thank you so much...I did not receive an error message w/this syntax!!
However, I may have another problem. When I tried to run the report, I
received an error message that essentially said my query 'did not include the
specified expression.' Basically, I'm trying to execute a query that
provides $ for each instructor that 'delivers' (teaches) and sometimes there
are 2 instructors for each 'delivery.' The report ran fine until I tried to
include this portion (w/the IIf) that includes 2 instructors for each
'delivery.' (Hope that makes sense)

Any insight would be much appreciated!


.



Relevant Pages

  • Re: Problem with execution
    ... through query analyser I would assume that there would be no rows to delete ... John ... > I can execute it from from Query Analyzer without any problems. ... >> if you get an error message. ...
    (microsoft.public.sqlserver.programming)
  • Re: "Select" & "Order By" OK- WHERE Doesnt Work !
    ... The error message was "could not execute query". ... format' 'artist'. ...
    (comp.lang.php)
  • Re: Using TransterText
    ... Thanks John, ... the results that are returned, which is a Recordset, to the TransferText ... the TransferText is expecting either a database or query name String. ... > insert the parameter values directly before you execute the TransferText. ...
    (microsoft.public.access.queries)
  • Re: Error Message: Invalid Bracketing when trying to set Parameter
    ... > The first query is a select query with a date range coming from a form. ... > No mater how I change the bracketing I still get the same error message. ... > "John Vinson" wrote: ...
    (microsoft.public.access.queries)
  • Re: Query of checkboxes.
    ... "John W. Vinson" wrote: ... Copy and paste that exact expression into a vacant Field cell in the query ... what's not working and how (error message? ...
    (microsoft.public.access.queries)