How to customize a text field based on a choice from a combo box

G

Guest

Hi there,

I would like to link a text field to a combo box such that when a specific
choice is made in the Combo Box, the User HAS to type in a number in the text
box. There are only 2 choices in the Combo Box and the validation is set such
that the User HAS to make one of the two choices. Now I want to do a second
'validation'- when the user makes ONE of the two choices, the user HAS to
change the default text in the text box. I tried using an IIF statement in
the text control (Properties, Validation): IIF([combo1]="choice1",
[text1]<>"default", ""), but it doesn't work with either choice. Any
suggestions? oh, and I'm SO NOT a developer or coder or whatever they're
called.

Thanks,
L.C.
 
G

Guest

Ugh. never mind. I found a Validation thing I could do... a SIMPLE "OR"
statement! Duh.
L.C.
 
S

Sue Mosher [MVP-Outlook]

Validation works like this: The validation formula must return True when the data is "good" and False when it is "bad." In your scenario, you have two cases where the data is "good":

When Choice #1 has been chosen in the combo box and the user has typed a number in the text box
When Choice #2 has been chosen in the combo box

As far as the formula goes, you can ignore Choice #1 itself, and use something like:

([ComboBoxField] = "Choice 2") OR ([TextBoxField] <> "default")

See how the two "good" types of data translate into two expressions, joined by OR?
--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
G

Guest

Thank you Sue. That worked perfectly! I'm now trying to do the same thing
with check boxes. I have 12 of them, and if 6 are chosen (any of the 6), I'd
like the user to be forced to enter text. Will the same validation format
work?

Thanks again... this is starting to be fun1
L.C.

Sue Mosher said:
Validation works like this: The validation formula must return True when the data is "good" and False when it is "bad." In your scenario, you have two cases where the data is "good":

When Choice #1 has been chosen in the combo box and the user has typed a number in the text box
When Choice #2 has been chosen in the combo box

As far as the formula goes, you can ignore Choice #1 itself, and use something like:

([ComboBoxField] = "Choice 2") OR ([TextBoxField] <> "default")

See how the two "good" types of data translate into two expressions, joined by OR?
--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers



L.C said:
Hi there,

I would like to link a text field to a combo box such that when a specific
choice is made in the Combo Box, the User HAS to type in a number in the text
box. There are only 2 choices in the Combo Box and the validation is set such
that the User HAS to make one of the two choices. Now I want to do a second
'validation'- when the user makes ONE of the two choices, the user HAS to
change the default text in the text box. I tried using an IIF statement in
the text control (Properties, Validation): IIF([combo1]="choice1",
[text1]<>"default", ""), but it doesn't work with either choice. Any
suggestions? oh, and I'm SO NOT a developer or coder or whatever they're
called.

Thanks,
L.C.
 
S

Sue Mosher [MVP-Outlook]

The same technique would work as long as you remember that checkboxes must always be bound to Yes/No fields, so the only allowable values for the checkbox fields are True and False.

But I'd do it a different way, taking advantage of the fact that in this context, True = -1 and False = 0. For your left-hand expression, add up all the field values and see if they are greater than or equal to -6.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers



L.C said:
Thank you Sue. That worked perfectly! I'm now trying to do the same thing
with check boxes. I have 12 of them, and if 6 are chosen (any of the 6), I'd
like the user to be forced to enter text. Will the same validation format
work?

Thanks again... this is starting to be fun1
L.C.

Sue Mosher said:
Validation works like this: The validation formula must return True when the data is "good" and False when it is "bad." In your scenario, you have two cases where the data is "good":

When Choice #1 has been chosen in the combo box and the user has typed a number in the text box
When Choice #2 has been chosen in the combo box

As far as the formula goes, you can ignore Choice #1 itself, and use something like:

([ComboBoxField] = "Choice 2") OR ([TextBoxField] <> "default")

See how the two "good" types of data translate into two expressions, joined by OR?

L.C said:
Hi there,

I would like to link a text field to a combo box such that when a specific
choice is made in the Combo Box, the User HAS to type in a number in the text
box. There are only 2 choices in the Combo Box and the validation is set such
that the User HAS to make one of the two choices. Now I want to do a second
'validation'- when the user makes ONE of the two choices, the user HAS to
change the default text in the text box. I tried using an IIF statement in
the text control (Properties, Validation): IIF([combo1]="choice1",
[text1]<>"default", ""), but it doesn't work with either choice. Any
suggestions? oh, and I'm SO NOT a developer or coder or whatever they're
called.

Thanks,
L.C.
 
G

Guest

Wow! That worked really well. Thank you so much for that tip... I would
not have thought of that!

L.C.

Sue Mosher said:
The same technique would work as long as you remember that checkboxes must always be bound to Yes/No fields, so the only allowable values for the checkbox fields are True and False.

But I'd do it a different way, taking advantage of the fact that in this context, True = -1 and False = 0. For your left-hand expression, add up all the field values and see if they are greater than or equal to -6.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers



L.C said:
Thank you Sue. That worked perfectly! I'm now trying to do the same thing
with check boxes. I have 12 of them, and if 6 are chosen (any of the 6), I'd
like the user to be forced to enter text. Will the same validation format
work?

Thanks again... this is starting to be fun1
L.C.

Sue Mosher said:
Validation works like this: The validation formula must return True when the data is "good" and False when it is "bad." In your scenario, you have two cases where the data is "good":

When Choice #1 has been chosen in the combo box and the user has typed a number in the text box
When Choice #2 has been chosen in the combo box

As far as the formula goes, you can ignore Choice #1 itself, and use something like:

([ComboBoxField] = "Choice 2") OR ([TextBoxField] <> "default")

See how the two "good" types of data translate into two expressions, joined by OR?

Hi there,

I would like to link a text field to a combo box such that when a specific
choice is made in the Combo Box, the User HAS to type in a number in the text
box. There are only 2 choices in the Combo Box and the validation is set such
that the User HAS to make one of the two choices. Now I want to do a second
'validation'- when the user makes ONE of the two choices, the user HAS to
change the default text in the text box. I tried using an IIF statement in
the text control (Properties, Validation): IIF([combo1]="choice1",
[text1]<>"default", ""), but it doesn't work with either choice. Any
suggestions? oh, and I'm SO NOT a developer or coder or whatever they're
called.

Thanks,
L.C.
 

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