drop-down box to control visibility

Brum

Registered User.
Local time
Today, 00:31
Joined
Aug 28, 2001
Messages
10
Hello people! I got a problem.

I have a form with a drop-down box ("StockCategory") with 10 options on it. I also have a command button ("cmdCables") that is only applicable when 1 ("Cables") of these 10 options is selected, but makes no sense when it's any of the other 9 options.

What I'd like is for the form to show the command button if "cables" is selected, both before the form opens and if a user selects "cables" while the form is open. But at all other times I want it invisible.

Does that make sense? Hmmm, any help would be great!

cheers,
Andi

[This message has been edited by Brum (edited 08-28-2001).]
 
You could try something like this in your form's On Current event and your combo box's After Update event:

Private Sub Form_Current()
If Me.StockCategory = "Cables" Then
Me.cmdCables.Visible = True
Else
Me.cmdCables.Visible = False
End If
End Sub

I *think* that should work.

HTH
 
Quality. That did the job. I tried that before, except I forgot the (apparantly- I don't understand why) important step of renaming the combo box. Which defaulted to a lookup table which was the thing that scuppered my system. So thanks a lot LQ!
 
An additional helpful(?) hint to reduce typing:

Private Sub Form_Current()

Me.cmdCables.Visible = (Me.StockCategory = "Cables")

End Sub
 

Users who are viewing this thread

Back
Top Bottom