Help with IIF Statement in Query

shevada123

New member
Local time
Today, 05:33
Joined
Apr 24, 2007
Messages
9
I have a database where I list prices for products. The prices are based on the type of customer.

I have a table that lists
Customer
Customer Type (can be DD or SH)

My other table with is the tire table has the following:

TireID
ITem Number
Description
Tire Price
Sh Price
List PRice

If the customer type is a DD - I need to use the List Price
If the customer type is SH - I need to use the SH Price

Here is the statements I've tried, but none of them are working..

Tire Price: IIf([customer type]=[dd],[SH Price],IIf([customer type]=[sh],[List Price]))

Tire Price: iif ([customer type]=”dd”, [SH Price], iif([customer type]=’’sh”,[List Price]))

Tire Price: IIf([Customer Type]=[DD],"[SH Price]")

I was using this IIF statment in my query but it is giving me a parmeter box with dd and then pulls up another box with sh before running the query. The query is not working.

I'd appreciate if someone can help me fix this issue.

Thanks
 
Tire Price: IIf([customer type]=[DD],[List Price],[SH Price])
should be all you need, but I think that you should post you query's SQL

Brian
 
Here is the SQL

SELECT [NWarrLog-Tires].[Claim Number], [NWarrLog-Claim Query].[Customer Type], [NWarrLog-Tires].TireID, [NWarrLog-Tires].Serial, [NWarrLog-Tires].TireIssueID, [NWarrLog-Tires].[Adj %], [List Price]*[Adj %] AS [Adjusted Price], [List Price ]*[Adj %]+[FET/Handling] AS TotalPrice, [NWarrLog-Tires].DOT, [NWarrLog-Tires].[FET/Handling], [NWarrLog-Tires].Comments, IIf([customer type]=[DD],[List Price],[SH Price]) AS [Tire Price], Tires.[O Tread], [NWarrLog-Tires].[R Tread], [List Price ]*[Adj %]+[FET/Handling] AS DNCMAMT
FROM [NWarrLog-Claim Query] INNER JOIN ([NWarrLog-Tires] INNER JOIN Tires ON [NWarrLog-Tires].TireID = Tires.TireID) ON [NWarrLog-Claim Query].[Claim Number] = [NWarrLog-Tires].[Claim Number];
 
Sorry Typo
Tire Price: IIf([customer type]="DD",[List Price],[SH Price])

This should work.

Brian
 

Users who are viewing this thread

Back
Top Bottom