Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

iif(Expression) Problem..

Status
Not open for further replies.

m1kee

Programmer
Mar 2, 2003
45
GB
I have two text boxes on a form which need to be able to calculate values, I can run an If statement in VBA and that runs fine; which is:
If Me.OrderOrigin = "Home" Then
Me.IncostHome = Me.TotalPrice * 0.0525 + 0.4
Else
Me.IncostHome = Me.TotalPrice = "£0.00"
End If
but when I try to convert this statement into an IIF expression things go wrong and normally the program just bombs out!

Could someone please tell me the best way to put this into an IIF expression using the expression builder; I need it to be the control source for the text box.

Many thanks,
Mikee.

Do or do not, there is no try. - Yoda
 
First of all, there must be a typo in the else portion of the above posted example of your IF statement.

Me.IncostHome = Me.TotalPrice = "£0.00" ??????? Makes no sense

The following is the format for the IIF statement

Code:
IIF(Me.OrderOrigin = "Home", Me.TotalPrice * .0525 + .4, [red][i] false value/calculation [/i] [/red])

Replace the red code with what you want returned if the expression is false.


Bob Scriver
[blue]Want the best answers? See FAQ181-2886[/blue]


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top