Showing a text box depending on the selection in a combo box

  • Thread starter Thread starter weircolin
  • Start date Start date
W

weircolin

Hi

Is it possible and if so, how, to make a text box appear or at least
only allow input to it if a certain selection is made in a combo box?

For instanct a selection called "Other" and then a text box saying
"Please Specify".

Thanks

Colin
 
Is it possible and if so, how, to make a text box appear or at least
only allow input to it if a certain selection is made in a combo box?

For instanct a selection called "Other" and then a text box saying
"Please Specify".

hope this is what you want

in the 'on Change' Event in the properties of the combo box click on the ...
button and choose 'Code builder

Private Sub CmbDate_Change()

If Me![NameOfComboBox] = "Other" Then
[NameOfTextBoxhere].visible = True
Else
[nameOfTextBoxhere].visible = False
End if

End sub

Hope you can get what you want out of this

Regan
 
Hi

Thanks for your reply, it doesn't seem to be working but every chance
I've done something wrong.

I'm able to input into it at any point and when I do, even when 'Other'
is selected I get the following message.

Run-time error '2165'

You can't hide a control that has the focus.

When clicking on Debug the line 'txtOther.Visible = False' is
highlighted.

Any thoughts?
Is it possible and if so, how, to make a text box appear or at least
only allow input to it if a certain selection is made in a combo box?

For instanct a selection called "Other" and then a text box saying
"Please Specify".

hope this is what you want

in the 'on Change' Event in the properties of the combo box click on the ...
button and choose 'Code builder

Private Sub CmbDate_Change()

If Me![NameOfComboBox] = "Other" Then
[NameOfTextBoxhere].visible = True
Else
[nameOfTextBoxhere].visible = False
End if

End sub

Hope you can get what you want out of this

Regan
 
Hi, i'm kinda new to access myself but have had to do something similar

Try. going into design view in the form and changeing the text box property
'visible' to No
Then goto back to normal view and select "other" from your combo box

Private Sub NameOFComboBox_Change()

If Me![NameOfComboBox] = "other" Then
[nameOfTextBox].Visible = True
Else
[nameOfTextBox].visible = false
End If

end sub

When you select 'other' from your combobox the Textbox should become visible.

Tryin to help :)
Regan
 
Hi Regan

Thanks, got it working now. Changed the .visible to .enable and
changed the "Enable" option to No.

Thanks for your help, really appreciate 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

Back
Top