Create a Validation Formulas

  • Thread starter Thread starter David Lao
  • Start date Start date
D

David Lao

Hi,

I tried to create a validation formulas for an input field without a
success. Here is the input in the field should contain "BUGM-" follow
with 8 digits number. Example, the valid value is BUGM-00001234 or
BUGM-12345678.

How can I create a formulas to valid this field ?


David
 
A validation formula must evaluate to True if the data is "good" and False
if the data is not. In your scenario, several conditions must be met:

1) The total length must be 13.
2) The first five characters must be "BUGM-"
3) The right-most eight characters must be numeric.

For #1, use the Len() function.
For #2, use Left().
#3 is the tricky one since Outlook forms don't support IsNumeric() for
validation formulas. Instead you can use Val():

(Len([MyField]) = 13) AND (Left([MyField], 5) = "BUGM-")
AND (Val([Right(MyField, 8)]) > 0)

This assumes that BUGM-00000000 is not a valid value. If so, then you'll
have to add a term to allow for that, since Val() will give you a value of 0
in that case.
 
Hi Sue,

It is very new to me to program in VBScript with Outlook. Thank you very
much for your helps.

David
 
Back
Top