Create a Validation Formulas

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


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
 
S

Sue Mosher [MVP-Outlook]

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.
 
D

David Lao

Hi Sue,

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

David




*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
 

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