hide / show controls based on combo box selection

N

Niconedz

Hi

I have a combo box with a list of options for types of real estate (House,
Villa, Apartment, Maisonette, etc.). When the user selects Apartments, I
want another two combo boxes to appear next to the first one asking for
Number of Storeys and Floor Number.

I am not a coder.

Can anyone tell me if this is possible, and how it is done.

Thanks
Nico
 
W

Wayne Morgan

Yes, it is doable. The combo boxes would have to already be on the form with
their Visible property set to No/False. In the AfterUpdate event of the
combo box, you would check the value of the combo box then set the Visible
properties of the approriate controls as desired. In the combo box's
properties sheet, set the AfterUpdate event to [Event Procedure] and click
the ... button to take you to the code editor with the basic information for
the event already inserted for you. This would go between the Private Sub
cboMyCombo_AfterUpdate and the End Sub statements.

Example:

If Me.cboMyCombo = "Apartments" Then
Me.cboCombo2.Visible = True
Me.cboCombo3.Visible = True
Else
Me.cboCombo2.Visible = False
Me.cboCombo3.Visible = False
End If

You can add any other contols as needed, change the names of the controls to
match the names of your controls.
 
N

Niconedz

Much obliged.


Wayne Morgan said:
Yes, it is doable. The combo boxes would have to already be on the form with
their Visible property set to No/False. In the AfterUpdate event of the
combo box, you would check the value of the combo box then set the Visible
properties of the approriate controls as desired. In the combo box's
properties sheet, set the AfterUpdate event to [Event Procedure] and click
the ... button to take you to the code editor with the basic information for
the event already inserted for you. This would go between the Private Sub
cboMyCombo_AfterUpdate and the End Sub statements.

Example:

If Me.cboMyCombo = "Apartments" Then
Me.cboCombo2.Visible = True
Me.cboCombo3.Visible = True
Else
Me.cboCombo2.Visible = False
Me.cboCombo3.Visible = False
End If

You can add any other contols as needed, change the names of the controls to
match the names of your controls.

--
Wayne Morgan
MS Access MVP


Niconedz said:
Hi

I have a combo box with a list of options for types of real estate (House,
Villa, Apartment, Maisonette, etc.). When the user selects Apartments, I
want another two combo boxes to appear next to the first one asking for
Number of Storeys and Floor Number.

I am not a coder.

Can anyone tell me if this is possible, and how it is done.

Thanks
Nico
 

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

Top