Combo Boxes

  • Thread starter Thread starter Stuart
  • Start date Start date
S

Stuart

Hi,

How do i link information between two combo boxes. I
have to do a form called ReportsMenu on this form there
has to be two combo boxes so when the user selects a
subject from one combo box from a drop down list then a
discription of that information will appear in the combo
box beside it. And there can be only one list of the
description.

Any ideas would be helpful

Thank you
 
Dear Stuart:

I'm thinking you mean that the combo boxes are operated in an order:
the Subject, then the Description. The list of Descriptions then
depends on which Subject was chosen. Right?

If so, then what you are doing is a classic "drill down" series of
combo boxes.

When the Subject is selected, use the Click event of its combo box to
generate a new SQL string for the row source of the Description combo
box. I usually check this string against the RowSource of the
dependent combo box (in your case, the Description combo box). If it
has not changed, then you're done.

The currently selected value in the Description combo box may or may
not be in the list. Check the ListIndex of the Description combo box.
If it's -1, then the previously selected value of the Description
combo box is not in the new list, as a result of changing the
RowSource. In that case, we usually either clear out the Description,
or we choose the first item in the list. If the best style for your
needs is to select the first item, be sure you sort the list so the
"default" value you'd like is at the top of the list.

There's a lot more to it than that, but I don't know how much of the
mechanics you'd need help with. I'll leave it at this until I've
heard back.

In part, your post sounds like the "description" is an attribute of
the subject (rather than a list of descriptions from which to choose).
That is, once you've made a selection for subject, the description is
already completely determined.

If so, there wouldn't be two combo boxes. Rather, the description
could just be displayed in a text box. This text box would be
calculated:

= [SubjectComboBox].Column(1)

It may or may not be 1 in the above. What you're doing here is
accessing the Description column from the combo box list. You'd
recalculate on the click event of the SubjectComboBox to get this to
update.

You would build the query for the SubjectComboBox so that it had the
description in an "extra" column not displayed. If you are showing
only the Subjects in the first (and only) column "Column(0)" then this
Description would be in Column(1). You can display it in the combo
box or hide it (just say the ColumnCount is 1). The Description value
for the selected row in the SubjectComboBox is then available for
reference throughout your form. It can be used in many ways. You may
want to reference the ListIndex first to make sure there IS a selected
item in the SubjectComboBox before using this value.

Hi,

How do i link information between two combo boxes. I
have to do a form called ReportsMenu on this form there
has to be two combo boxes so when the user selects a
subject from one combo box from a drop down list then a
discription of that information will appear in the combo
box beside it. And there can be only one list of the
description.

Any ideas would be helpful

Thank you

Tom Ellison
Ellison Enterprises - Your One Stop IT Experts
 
Back
Top