How to make visible tex box using combo box

Birkofas

New member
Local time
Today, 05:58
Joined
Apr 29, 2008
Messages
8
Hi All

I have combo box and unbound text box.
Combo box [Ethnicity] fields are:


White British
White Irish
White Greek or Greek Cypriot
Cypriot
Any other White (please specify)
Mixed White and Black African
Mixed White and Asian
Any other Mixed (please specify)
Indian
Pakistani
Bangladeshi
Any other Asian (please specify)
Caribbean
Somali
Congolese
Nigerian
Ghanaian
Kenyan
Any other Black (please specify)
Chinese
(please specify)

when i select fields like "Any other ...(please specify)"
the text box have become visible. I have no idea how to do that.
Can you help me again guys? Please
 
Simple Software Solutions

Use the AfterUpdate Property of the combo box and enter the following code

Code:
If InStr(Me.ComboBox,"Specify") > 0 then
   Me.TextBox.Visible = True
Else
   Me.TextBox = ""
   Me.TextBox.Visible = False
Endif

You may wonder why I added the MeTextBox = "" line?
If you are using unbound forms and using Recordsets to Add New/Update underlying tables you may get the situation where you update record 1 then move to record 2 and update again. So as not to confuse the code jusrt make sure that if it is not visible it cannot have a value.

CodeMaster::cool:
 
Everything is working fine.

Thanks
 
Last edited:
Simple Software Solutions

Can you be a bit more specific :confused:

but then i scrolling up and down the text box not disappearing when record is not "specify".

By scrolling do you mean highlighting different items in the combobox? Why would you be scrolling within a textbox. You should only be able to access the textobx if "specify" appears in the selected item in the combobox.

To get the text box to appear / dissapear use the code on the OnClick property of the combobox.


David
 

Users who are viewing this thread

Back
Top Bottom