Combo dependency changes look of form

mgerada

New member
Local time
Tomorrow, 02:42
Joined
Feb 7, 2006
Messages
7
Hi to all

I have limited knowledge regarding writing code and have had some challenge in trying to create the following:

a. changed appearance of other controls on same form dependent on selection in first control and
b. msgbox to appear dependent on selection of first combo box.

Background

I have created a database in which on one form for creating a new record there are five combo boxes:

1. Category Selection (different to combo no 4 Category)
2. Priority
3. Status
4. Category and
5. Staff member

To create a new record the first decision is to select an item from Category Selection (Combo 1). Some of the remaining combo boxes are relevant to some of the categories listed in the Category Selection list eg one category selection (say Action) requires only combos 2 and 3 to show for selection of a priority and status while category selection (Feedback) requires combos 3 and 4 ie status and category. Can code be written so that on the selection of an item in the Category Selection eg Action only combos 2 and 3 appear and combo 4 is hidden?

And at the same time a msgbox shows to verify the category selection made is the correct one?

I hope it is possible and look forward to hearing from the those who have gone before me tha I may learn.

Thanks for your consideration in anticipation.

Cheers

Marty:)
 
a. changed appearance of other controls on same form dependent on selection in first control

I don't know what you mean with " selection in first control", because you don't say what type of control (text box, combo, list box etc) so I have given you 2 examples 1 for text box and 1 for combo.

Code:
If Me.txtFirstBox > 5 Then
    Me.txtSecondBox.BackColor = vbRed
Else
    Me.txtSecondBox.BackColor = vbGreen
End If


msgbox to appear dependent on selection of first combo box.

Code:
If Me.cboRating.Column(1) = > 5 then 

     Msgbox "The rating is over the limit"

end if
 
Thanks John for your response.

I am presently under pressure with work and will look at it in a while and get back. Wanted to let you know that I did see your suggestion.

Cheers

Marty
 
Hi again John

I have just got back to this and you are right I was confusing using the term first control when I mean Combobox No 1 (ie Category Selection). So basically when creating a new record all comboboxes are visible and when I select from the drop down list in Combbox no1 (eg Action) then only combos 2 and 3 remain and combobox 4 becomes hidden or invisible only for the selection of Action.

When a new record is created and a different item from the drop down in Combobox no1 eg Feedback then combos 3 and 4 ie status and category remain and combobox 2 becomes hidden or invisible.

Is what you have suggested still the way to go??

Many thanks again

Marty
 
Is this what you are trying to do;

Combo1 (Countries of the World)

Combo2 (States of those Countries)

Combo3 (Cities of those states)


Select from combo1 "Australia"

Combo 2 will show 8 States and Territories

Select from combo2 "Victoria"

Combo 3 will display all cities in the state of Victoria,Australia

If that is what you want to do then; do a search on "Cascading Combo's"

If that is not what you want to do and you just want to hide combo boxes, let me know what is in each combo and what triggers the hidding of one. Post and sample db with your combos in and then explain what you wish to do.
 

Users who are viewing this thread

Back
Top Bottom