Outlook form control - conditional formatting

  • Thread starter Thread starter Daniel Lalonde
  • Start date Start date
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
 
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
 
Back
Top