Outlook form control - conditional formatting

D

Daniel Lalonde

Hi,

Any and all help is appreciated. I have an Outlook form
that submits orders. I am working with the following
controls:

Item Description: Textbox (txtItem)
Item Quantity: Combobox (cboItemQuantity) with a user
defined number field called usrItemQuantity
Item Details: Combobox (cboItemDetails) with a user
defined text field called usrItemDetails
Item Points: Textbox (txtItemPoints) with a user defined
number field called usrItemPoints.

Right now the initial value (updates automatically) in the
txtItemPoints is set to [usrItemQuantity]*10 where the
value one is the predetermined value for this item in
general. Currently there is no relation to the
cboItemDetails. However, what I still need to do is build
a conditional statement that accounts for values contained
in usrItemDetails. I think that I need to have an
If...Else statement but I am not sure how to write it.

Pseudocode example:
IF [usrItemDetails] = "Pants" Then
[usrItemQuantity]*5
ELSEIF [usrItemDetails] = "Shirt" Then
[usrItemQuantity]*10
Else
[usrItemQuantity]*2
ENDIF

If this is indeed the solution, how what would be the
correct syntax to enter into the user defined Initial
Value field for txtItemPoints?

Hopefully I have been clear on what I am looking for.
Thanks in advance for any solutions.

Daniel
 
S

Sue Mosher [MVP]

The formula function I think you're looking for is IIf():

IIf([usrItemDetails] = "Pants", [usrItemQuantity]*5, IIf([usrItemDetails] = "Shirt", [usrItemQuantity]*10, [usrItemQuantity]*2) )

Better count my parentheses. I hate using complicated formulas and would rather right script, which can be debugged much more easily.

FYI, there is a separate newsgroup for Outlook forms issues -- microsoft.public.outlook.program_forms.

--
Sue Mosher, Outlook MVP
Outlook and Exchange solutions at http://www.slipstick.com
Author of
Microsoft Outlook Programming: Jumpstart
for Administrators, Power Users, and Developers
http://www.slipstick.com/books/jumpstart.htm
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top