Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Combo box

Status
Not open for further replies.

daleshei

Technical User
Mar 28, 2007
12
GB
I have a form with a combo box populated by a Table which contains a list of agencies.

e.g.

Agency1
Agency2
Agency3
Agency Other (pls specify)

I have a text box next to the combo box and I want it to be greyed out and only enable it
when the user choses "Agency Other (pls specify)" to type the other agency.

Any idea on how to do this in VBA?

Thanx in advance

D
 
How are ya daleshei . . .

In the [blue]AfterUpdate[/blue] event of the combobox:
Code:
[blue]   Me.[purple][b]TextboxName[/b][/purple].Enabled = (Me.[purple][b]ComboboxName[/b][/purple].Column(1) = "Agency Other (pls specify)")[/blue]
You might have to play with the column index [blue]Column([purple]x[/purple])[/blue]. Note: column index starts at zero and includes any hidden columns in the [blue]Column Widths[/blue] property.

Calvin.gif
See Ya! . . . . . .
 
Thanx for the code, here's another problem

The txtbox is not greyed out and only gets greyed out when I chose Agency 1,2 or 3. Is there a way of greying it out permanently and only appears when I chose "Agency Other"?

Also if the txtbox wasn't greyed out on the previous record and I create a new record the txtbox is still not greyed out.

Thanx again

D


 
daleshei . . .

Run the code from the [blue]On Current[/blue] event of the form as well . . .

Calvin.gif
See Ya! . . . . . .
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top