How to add required fields to an Outlook form

G

Guest

In a form to request that a distribution center not pick a product/products,
I want the alpha-numeric Model # field and the Reason field on each of nine
lines to be a required entry. I have tried Properties such as Validation "A
value is required for this field" but that led to errors in using the
template. Also tried using some formulas but the Model # list and Reason list
is quite extensive and can't be used in an expression such as IIf( expr ,
truepart , falsepart ). So how do I make fields required?
 
S

Sue Mosher [MVP-Outlook]

You have to use either a formula or code in the Item_Write event handler.
Think about what you'll accept as "good" data and what other constraints
(such as a combo box with a match required) are operating on those fields.

FYI, IIf() is almost never used in validation formulas, which must evaluate
to either True or False. If these fields are text fields, you can use this
formula on each one:

[FieldName] <> ""
 
G

Guest

Sue,
Appreciate your suggestion but I'm not clear about using the Item_Write
event handler or the Validation field. Tried using the formula you suggested,
[FieldName] <> "", in the Validation field but it didn't stop a user from
sending a form with empty required fields.

Or were you suggesting [FieldName] <> "" written into the code in the
Item_Write event handler? If so, for a form with 9 lines/8 fields per line
what are the conventions in writing a code string as far as parenthesis,
brackets, commas etc. to enable 4 fields (all text) on each line to be
required, if and only if, one field on a line has an entry.

Sue Mosher said:
You have to use either a formula or code in the Item_Write event handler.
Think about what you'll accept as "good" data and what other constraints
(such as a combo box with a match required) are operating on those fields.

FYI, IIf() is almost never used in validation formulas, which must evaluate
to either True or False. If these fields are text fields, you can use this
formula on each one:

[FieldName] <> ""

--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers



RF Office user said:
In a form to request that a distribution center not pick a
product/products,
I want the alpha-numeric Model # field and the Reason field on each of
nine
lines to be a required entry. I have tried Properties such as Validation
"A
value is required for this field" but that led to errors in using the
template. Also tried using some formulas but the Model # list and Reason
list
is quite extensive and can't be used in an expression such as IIf( expr ,
truepart , falsepart ). So how do I make fields required?
 
S

Sue Mosher [MVP-Outlook]

No, I was suggesting that if you put [FieldName] <> "" as the validation
formula for a text field named FieldName, the user will be forced to fill in
that field. Of course, if the actual field name and the name of the field in
the validation formula don't match, the formula won't work.

I don't know what you mean by "9 lines/8 fields per line".

--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers



RF Office user said:
Sue,
Appreciate your suggestion but I'm not clear about using the Item_Write
event handler or the Validation field. Tried using the formula you
suggested,
[FieldName] <> "", in the Validation field but it didn't stop a user from
sending a form with empty required fields.

Or were you suggesting [FieldName] <> "" written into the code in the
Item_Write event handler? If so, for a form with 9 lines/8 fields per line
what are the conventions in writing a code string as far as parenthesis,
brackets, commas etc. to enable 4 fields (all text) on each line to be
required, if and only if, one field on a line has an entry.

Sue Mosher said:
You have to use either a formula or code in the Item_Write event handler.
Think about what you'll accept as "good" data and what other constraints
(such as a combo box with a match required) are operating on those
fields.

FYI, IIf() is almost never used in validation formulas, which must
evaluate
to either True or False. If these fields are text fields, you can use
this
formula on each one:

[FieldName] <> ""

message
In a form to request that a distribution center not pick a
product/products,
I want the alpha-numeric Model # field and the Reason field on each of
nine
lines to be a required entry. I have tried Properties such as
Validation
"A
value is required for this field" but that led to errors in using the
template. Also tried using some formulas but the Model # list and
Reason
list
is quite extensive and can't be used in an expression such as IIf( expr
,
truepart , falsepart ). So how do I make fields required?
 
G

Guest

OK the formula worked when I used it in the Validation field. Thanks!

However, what I really need is a way to make a field conditionally required.
For example, on the first box of each of the nine lines of this form I have a
drop down box for a distribution center and each of those boxes has a unique
field name. Oftentimes it will not be necessary to complete all nine lines.
So what I need is, if the distribution center box is completed, then three
fields on that line MUST be filled in, such as Model Type, Reason etc.

Sue Mosher said:
No, I was suggesting that if you put [FieldName] <> "" as the validation
formula for a text field named FieldName, the user will be forced to fill in
that field. Of course, if the actual field name and the name of the field in
the validation formula don't match, the formula won't work.

I don't know what you mean by "9 lines/8 fields per line".

--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers



RF Office user said:
Sue,
Appreciate your suggestion but I'm not clear about using the Item_Write
event handler or the Validation field. Tried using the formula you
suggested,
[FieldName] <> "", in the Validation field but it didn't stop a user from
sending a form with empty required fields.

Or were you suggesting [FieldName] <> "" written into the code in the
Item_Write event handler? If so, for a form with 9 lines/8 fields per line
what are the conventions in writing a code string as far as parenthesis,
brackets, commas etc. to enable 4 fields (all text) on each line to be
required, if and only if, one field on a line has an entry.

Sue Mosher said:
You have to use either a formula or code in the Item_Write event handler.
Think about what you'll accept as "good" data and what other constraints
(such as a combo box with a match required) are operating on those
fields.

FYI, IIf() is almost never used in validation formulas, which must
evaluate
to either True or False. If these fields are text fields, you can use
this
formula on each one:

[FieldName] <> ""

message
In a form to request that a distribution center not pick a
product/products,
I want the alpha-numeric Model # field and the Reason field on each of
nine
lines to be a required entry. I have tried Properties such as
Validation
"A
value is required for this field" but that led to errors in using the
template. Also tried using some formulas but the Model # list and
Reason
list
is quite extensive and can't be used in an expression such as IIf( expr
,
truepart , falsepart ). So how do I make fields required?
 
S

Sue Mosher [MVP-Outlook]

I'm having a difficult time following your description, because Outlook forms don't have any concept of "lines." But let's try anyway: If the text Distribution Center text box has data in it, then the Model Type box also needs data in it. Is that correct? If so, try applying the logic we've already discussed to create a validation formula for the Model Type box.

What are scenarios when Model Type has "good data"? One is when the Distribution Center text box is blank. Another is when the Distribution Center text box is not blank and the Model Type box is not blank. Expressed as two True/False expressions in a validation formula, this would look like:

([Distribution Center] = "") OR ([Model Type] <> "")
--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers



RF Office user said:
OK the formula worked when I used it in the Validation field. Thanks!

However, what I really need is a way to make a field conditionally required.
For example, on the first box of each of the nine lines of this form I have a
drop down box for a distribution center and each of those boxes has a unique
field name. Oftentimes it will not be necessary to complete all nine lines.
So what I need is, if the distribution center box is completed, then three
fields on that line MUST be filled in, such as Model Type, Reason etc.

Sue Mosher said:
No, I was suggesting that if you put [FieldName] <> "" as the validation
formula for a text field named FieldName, the user will be forced to fill in
that field. Of course, if the actual field name and the name of the field in
the validation formula don't match, the formula won't work.

I don't know what you mean by "9 lines/8 fields per line".

--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers



RF Office user said:
Sue,
Appreciate your suggestion but I'm not clear about using the Item_Write
event handler or the Validation field. Tried using the formula you
suggested,
[FieldName] <> "", in the Validation field but it didn't stop a user from
sending a form with empty required fields.

Or were you suggesting [FieldName] <> "" written into the code in the
Item_Write event handler? If so, for a form with 9 lines/8 fields per line
what are the conventions in writing a code string as far as parenthesis,
brackets, commas etc. to enable 4 fields (all text) on each line to be
required, if and only if, one field on a line has an entry.

:

You have to use either a formula or code in the Item_Write event handler.
Think about what you'll accept as "good" data and what other constraints
(such as a combo box with a match required) are operating on those
fields.

FYI, IIf() is almost never used in validation formulas, which must
evaluate
to either True or False. If these fields are text fields, you can use
this
formula on each one:

[FieldName] <> ""
message
In a form to request that a distribution center not pick a
product/products,
I want the alpha-numeric Model # field and the Reason field on each of
nine
lines to be a required entry. I have tried Properties such as
Validation
"A
value is required for this field" but that led to errors in using the
template. Also tried using some formulas but the Model # list and
Reason
list
is quite extensive and can't be used in an expression such as IIf( expr
,
truepart , falsepart ). So how do I make fields required?
 

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