Subform with comboboxes

G

Guest

I have a continuous subform that has several comboboxes. The first combobox
so far is unbound and gets its list from selections made on the main form.
This part works fine. The second combobox is of workers filtered by the
company selected in the first. This also works. Sort of.
The second combobox cboWrkr is bound to the table where the info is stored.
When the first combobox is selected in any record of the continuous subform,
all the other visible names disappear if they work for a different company.
I don't need to store the company info again, only the name of the person.
Their company affiliation is stored in a separate table.
I think I need to change the rowsources dynamically but not sure at what
points. When the form is opened to an existing record it needs to be
different for viewing than for when a new main form is added or the subform
is being edited.
Hope that isn't too confusing.
Thanks
Rich J
 
M

Marshall Barton

Rich said:
I have a continuous subform that has several comboboxes. The first combobox
so far is unbound and gets its list from selections made on the main form.
This part works fine. The second combobox is of workers filtered by the
company selected in the first. This also works. Sort of.
The second combobox cboWrkr is bound to the table where the info is stored.
When the first combobox is selected in any record of the continuous subform,
all the other visible names disappear if they work for a different company.
I don't need to store the company info again, only the name of the person.
Their company affiliation is stored in a separate table.
I think I need to change the rowsources dynamically but not sure at what
points. When the form is opened to an existing record it needs to be
different for viewing than for when a new main form is added or the subform
is being edited.


I can't say I followed your situation 100%, but since no one
else seems to want to take a shot at it, I'll give it a try.

I think the problem (as opposed to your thoughts about a
solution) is only that the workers combo box displays blank
on the records that have a different selection in the
companies combo box.

This situation is clearly caused by the fact that the value
in the worker field is not in the workers combo box's
RowSource (because it is filtered by the companies combo
box).

The only way I can think of to display the worker name is to
include the workers tables in the form's record source query
and bind a locked text box to the worker name field. The
text box is placed directly on top of the text portion of
the combo box and a little code is used to shift the focus
from the text box to the combo box.

If I'm on the right track, and if you need more detailed
assistance, post back with additional information about the
form and workers tables, their important fields and the two
combo box controls.
 
G

Guest

Thanks Marshall, I pretty much follow what you're saying. I was thinking
about placing another combo or textbox over those and make them visible or
hide depending whether the subform was being just viewed or edited. But was
thinking that might be my own complicated method. I got the comboboxes to
filter the way I need but then ran into that problem with unbound box. I'll
let you know how I do before I bother you with posting more. Thanks again.
 
M

Marshall Barton

OK, we'll be here ;-)

This problem is not uncommon and it is not obvious how to
deal with it, so feel free to come back for more help if you
need it.
 

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