COMBO BOX : Specifying Item not in List

Will04

Registered User.
Local time
Today, 12:56
Joined
May 29, 2006
Messages
62
Hi everyone,

I have a form with a field named TREATMENT with the following options :-

1 Cryotherapy
2 Radiotherapy
3 Chemotherapy
4 None
5 Other (specify)

If the 5th option (Other) is selected, the user is required to specify what 'Other' represents.

I have created a combo box with the first 4 options and in instances of 'Other' the user can enter specific treatment that is not in the list (1 to 4).

What I would like to do is whenever the user enters a value that is not on the list (1 to 4), I would like to insert the word OTHER in front of the value entered. In other words all values not on the list will be prefixed by 'OTHER'.
E.G. if 'Surgery' is entered, I would like the value 'OTHER : Surgery' to be stored in the Treatment field of the table.

This will help in the generation of statistics from the table.

Any suggestions??

Many thanks in advance.


Will
 
Hello:

If you have a combo box with the entries you provide above, The below code places asks for the custom value by way of the inputbox function and places it in a textbox control name txtText1
'
Regards
Mark
'
Private Sub cboCombo1_AfterUpdate()
Dim CustomValue
'Store the selected value in txtText1 text box
If cboCombo1 = "Other" Then
CustomValue = InputBox("Please make an entry")
txtText1 = "Other: " & CustomValue
Else
txtText1 = cboCombo1
End If
End Sub
 
Thank You

Hi mhartman,

Your code worked wonderfully.. Thanks so much


Appreciated.

Will
 
Hello:

Your welcome and best wishes on your project.
Regards
Mark
 

Users who are viewing this thread

Back
Top Bottom