Link to home
Start Free TrialLog in
Avatar of SteveL13
SteveL13Flag for United States of America

asked on

Problem with IIf

I am having a problem with an IIf in a text box control source.  What is wrong with this code?

=IIf([txtTotal PartNQtyNeeded]-[txtTotAvail])=<0, 0, [txtTotal PartNQtyNeeded]-[txtTotAvail])

--Steve
ASKER CERTIFIED SOLUTION
Avatar of Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1)
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of SteveL13

ASKER

Got that.  But I also get an error...  "The espression you entered has a function containing the wrong number of arguments".

??
check again what you have ...
Here is exactly what I have... (copy and paste)

=IIf([txtTotalPartNQtyNeeded]-[txtTotAvail])=<0,0,[txtTotalPartNQtyNeeded]-[txtTotAvail])
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Just a tip...

For syntactical issues in control sources like this, you can put the expression in the VBA editor like this:

x = IIf([txtTotal PartNQtyNeeded]-[txtTotAvail] <= 0, 0, [txtTotal PartNQtyNeeded]-[txtTotAvail])

Doing so makes it easier to track down errors (the expressions turn red if the syntax is off).