Combo Box problem (Difficult)

J

Janelle

I have an interesting dilemma and I'm having trouble
thinking it through. If anybody has any ideas, they'd be
appreciated. I apologize for the length of the post, but
it seemed easier than answering dozens of questions about
missing details.

I have a set of 3 cascading combo boxes (cboBrand,
cboCategory, cboSubCategory). So what is chosen for Brand
and Category limits the list for Category & SubCategory,
although some categories apply to more than one brand.

Everything was working great until I realized that
sometimes we have to change which categories and
subcategories are currently valid choices. So now when
going through records (View = Single Form), some
categories and subcategories show up as blank, because
their values are no longer in the combo box's list.

My next thought was to give the Category & SubCategory
combo boxes transparent backstyles and create cboCategory2
& cboSubCategory2 combo boxes behind the originals. These
boxes would contain ALL of the possibilities, regardless
of whether they're currently valid or not. So if the
front box is empty, the back box still shows the correct
value. But if I change the brand or the category, I have
to switch the following combo boxes back to showing only
the originals so the user knows if the old category or
subcategory is not valid with the information they've just
chosen. Then the OnCurrent event resets the backstyle to
transparent for the next record.

That seemed ok until I realized that although it is a good
INDICATOR to the user, it doesn't FORCE them to choose a
new category or subcategory if there is no value visible.
So if they go to another record and come back, now the
value that was still there, just not visible, is now
visible as an "old" value.

Naturally, one option would be to clear the category and
subcategory boxes after a change to the brand or
category. But as I said earlier, some are valid in more
than one brand or category. I'd hate to lose all
information just because the brand was originally entered
wrong. Also, I know from experience that it wouldn't be
THAT hard for the user to accidentally make a change to
the brand combo box and not remember what the subcategory
was that has now been cleared. But they can usually
remember what the brand originally was, and if the info is
still stored, they could just fix the brand and
everything's back the way it should be.

My next thought was to test for blank combo boxes before
leaving the record, but the two problems with that are:
1. I'm not sure if that's possible or not. The text
property seems to be the appropriate one to check, but
only works if the control has focus.
2. I haven't figured out how to differentiate between the
boxes that are supposed to be empty and the ones that
aren't. Maybe test against what the value of everything
was when the record was opened?
 
R

Rick Brandt

Janelle said:
I have an interesting dilemma and I'm having trouble
thinking it through. If anybody has any ideas, they'd be
appreciated. I apologize for the length of the post, but
it seemed easier than answering dozens of questions about
missing details.

I have a set of 3 cascading combo boxes (cboBrand,
cboCategory, cboSubCategory). So what is chosen for Brand
and Category limits the list for Category & SubCategory,
although some categories apply to more than one brand.

Everything was working great until I realized that
sometimes we have to change which categories and
subcategories are currently valid choices. So now when
going through records (View = Single Form), some
categories and subcategories show up as blank, because
their values are no longer in the combo box's list.
[snip]

Your RowSource queries currently looks something like...

SELECT Blah From SomeTable WHERE SomeField = Forms!SomeForm!SomeComboBox

Change that to...

SELECT Blah From SomeTable WHERE SomeField = Forms!SomeForm!SomeComboBox OR
SomeField = Forms!SomeForm!SomeOtherComboBox

Essentially you need to the query to return all rows that are current valid
choices AND any row that matches the existing entry on the form. This
doesn't work so well with continuous forms, but in single view it should
solve your problem.
 
J

James Goodman

What about adding a column to each table:
Name: [Valid]
Type: Yes/No

Then change the SQL for your Rowsource to SELECT * FROM Table Where [Valid]
= True AND AnyOtherConditions

That way it is pretty dynamic in what is a currently valid selection...

--
Cheers,


James Goodman MCSE, MCDBA
http://www.angelfire.com/sports/f1pictures
 
R

Russ

I believe I have done what you are doing. It's not simple but it's
not too hard either. When you change some item in a category what
happens?

These should be separated into 3 tables. The Main category should
have two fields, ID and name. The sub category should have 3 fields
ID, name, and the main category ID it is tied to. The most detailed
category (brands?) should have 3 fields ID, name, and the ID from the
sub category it is tied to.

Then all three tables should be linked one to many and enforcing
referential integrity with the broadest category on the one side and
the sub category and brands on the many side.

Then when one category is deleted for example, it's downstream
subcategories will also be deleted and therefore will have no blank
spaces.

Do I understand your problem?
Hope this helps.
Russ


Janelle said:
I have an interesting dilemma and I'm having trouble
thinking it through. If anybody has any ideas, they'd be
appreciated. I apologize for the length of the post, but
it seemed easier than answering dozens of questions about
missing details.

I have a set of 3 cascading combo boxes (cboBrand,
cboCategory, cboSubCategory). So what is chosen for Brand
and Category limits the list for Category & SubCategory,
although some categories apply to more than one brand.

Everything was working great until I realized that
sometimes we have to change which categories and
subcategories are currently valid choices. So now when
going through records (View = Single Form), some
categories and subcategories show up as blank, because
their values are no longer in the combo box's list.
[snip]

Your RowSource queries currently looks something like...

SELECT Blah From SomeTable WHERE SomeField = Forms!SomeForm!SomeComboBox

Change that to...

SELECT Blah From SomeTable WHERE SomeField = Forms!SomeForm!SomeComboBox OR
SomeField = Forms!SomeForm!SomeOtherComboBox

Essentially you need to the query to return all rows that are current valid
choices AND any row that matches the existing entry on the form. This
doesn't work so well with continuous forms, but in single view it should
solve your problem.
 

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