Show a Combo Box when an Item is Selected

othmanyg

Registered User.
Local time
Today, 21:23
Joined
Feb 1, 2000
Messages
43
HI, I need this help please,

I have a combo Box that contains some Status items like Completed, In progress, and pending. I have another Field named Reason. How can i make the Field Reason appear ONLY when I select the pending item from the Combo Box.

Your help is appreciated.:)
 
Try this: In the Combo Box's AfterUpdate event put the code

Me.tbxReason.Visible = (Me.cboStatus = "Pending")

where tbxReason is the name f the Reason text box, cboStatus is the name of the Status combo box, and "Pending" is the value of cboStatus when the Pending choic is selected.

Jim
 
Thanks Jim, I tried what you told me but it did not work, in fact the Reason Field is a Combo Box not a Text Box, and i tried cboReason instead of tbxReason and it did not work either. It was refering to a macro error. Can you help please.

I do appreciate it. Regards,:)
 
If this for a data entry form .........

Use the After Update event of the combobox:

Private Sub YourComboBoxName_AfterUpdate()
If Me.YourComboBoxName = "pending" Then
Me.Reason.Visible = True
Else
Me.Reason.Visible = False
End If
End Sub

In the code above I assume the name of the control you want to show is named "Reason". You need to initially set the "visible" property of the control to false so it will be hidden when the form opens. Also change "YourComboBoxName" to the actual name of your combobox.

If the form is used to view existing data then you will need to use the On Current event of the form to set the visible property based on the exiting data.

HTH
RDH
 
Last edited:
Greetings Mr. Hicks,

It worked just perfect, thanks very very much for the help. This is really a great web site to visit.

Once again, i appreciate it.
 

Users who are viewing this thread

Back
Top Bottom