PDA

View Full Version : Trying to multiply or divide based on "Var"



BarbWest
02-10-2017, 08:07 AM
This is what I've tried.
IIf([Var]="2" or "1.5"),[CustPrice]=Sum([Cost]*[Var]), Else IIf([Var]=".7",[CustPrice]=Sum([Cost]/[Var])
I'm getting an error reading ...to many arguments...?

HiTechCoach
02-10-2017, 08:27 PM
Looks like a mashup of the IIF() function, the VBA statement and IF..Then...Else, and SQL Sum() for totaling in a query. :eek:

Where are you trying to use this IIF()?


1) If in a VBA SUB or function, please post the routine.


2) If a query, please post the entire SQL statement.

3) Or in the control source for a text box on a form or report?


Is [VAR] really a data type text/string?

Assunign [VAR] is data tyepe text:

An IIF() would look something like:


=IIf( ([Var]="2" or [Var]= "1.5"), ([Cost]*[Var]) , IIf([Var]=".7",[Cost]/[Var], ([Cost]*[Var])

n If...Then...Else would look something like:



If ([Var]="2" or [Var] = "1.5") Then

[CustPrice]=([Cost]*[Var])

ElseIf ([Var]=".7"

[CustPrice]=([Cost]/[Var])

End if