>My MS SQL skills are under great test at the moment. I was wondering if
>I could get some help on this problem.
[quoted text clipped - 29 lines]
>then I want the 'Total Hours' for the lower value of 'total
>planned sales' equal to 0. Such is the case with Functional ID 3347.
Thanks for the reply. I tried that but am getting the following errors.
First of all the Total Hrs field is displaying as #Error. Once I click
in that field this is what it says
"The expression you entered as a query parameter produced this error: '
The object does not contain the Automation object 'MJ'.
MJ part of the field in Functional ID
This is what my SQL looks like.
SELECT [Installed Base Eastern Region - Contract - MP].FunctLocation,
[Installed Base Eastern Region - Contract - MP].[SumOf*Total Planned
Sales], IIf([SumOf*Total Planned Sales]<DMax("[SumOf*Total Planned
Sales]","[Installed Base Eastern Region - Contract -
MP]","[FunctLocation]=" & [FunctLocation]),0,[Total Hrs]) AS Expr1,
[Installed Base Eastern Region - Contract - MP].[Total Hrs]
FROM [Installed Base Eastern Region - Contract - MP];
> Create a query based on the existing query, output the first and last fields
> directly, and use this calculation instead of Total Hours:
[quoted text clipped - 39 lines]
> Message posted via AccessMonster.com
> http://www.accessmonster.com/Uwe/Forums.aspx/access-queries/200611/1
kingston - 30 Nov 2006 16:33 GMT
If [Functional ID] is not a number, you'll have to enclose it in quotes in
the query:
IIF([Sum...Sales]<DMax("[Sum...Sales]","[OriginalQuery]","[Functional ID]='"
& [Functional ID]) & "'",0,[Total Hours])
>Thanks for the reply. I tried that but am getting the following errors.
>
[quoted text clipped - 20 lines]
>> Message posted via AccessMonster.com
>> http://www.accessmonster.com/Uwe/Forums.aspx/access-queries/200611/1
Addy - 30 Nov 2006 20:31 GMT
Thanks for the reply.
I think I am almost there.
The error message now is:
"Syntax error in string in query expressing '[FunctionalID] =
'555-444-555'.
This is what I have in the code section.
IIF([SumOf*Total Planned Sales]<DMax("[SumOf*Total Planned
Sales]","[Installed Base Eastern Region - Contract -
MP]","[FunctLocation]='"
& [FunctLocation]) & "'",0,[Total Hrs])
Please let me know where I am going wrong.
> If [Functional ID] is not a number, you'll have to enclose it in quotes in
> the query:
[quoted text clipped - 30 lines]
> Message posted via AccessMonster.com
> http://www.accessmonster.com/Uwe/Forums.aspx/access-queries/200611/1
kingston - 30 Nov 2006 20:58 GMT
This should be one long line:
IIF([SumOf*Total Planned Sales]<DMax("[SumOf*Total Planned Sales]","
[Installed Base Eastern Region - Contract - MP]","[FunctLocation]='" &
[FunctLocation] & "'),0,[Total Hrs])
>Thanks for the reply.
>
[quoted text clipped - 19 lines]
>> Message posted via AccessMonster.com
>> http://www.accessmonster.com/Uwe/Forums.aspx/access-queries/200611/1
Addy - 30 Nov 2006 21:09 GMT
Thanks a million. It seems to be working. Cheeers!!!
> This should be one long line:
>
[quoted text clipped - 29 lines]
> Message posted via AccessMonster.com
> http://www.accessmonster.com/Uwe/Forums.aspx/access-queries/200611/1