Cascading comboboxes on a continuous Form issue

G

Guest

Hello,

I'm using cascading comboboxes to fill out the fields in a form (combox 2
filtered base on combobox 1 and combobox 3 filtered based on combobox 2).
This works fine on a single row form.
Howerver when used on a continuous form I have an issue with the fact that
comboboxes 2 and 3 are requeried for the current record for all records and
that the values shown for al those records are wrong (access 2000) or not
visible (Access 2002/2003). The continuous form is bound to a table. The
rowsource for combobow 2 and 3 is a parmaterizd query. The id is written to
the bound control of the combobox and the users is shown not the code but
the description in the combobox (2 column comboboxes, first with the ID to
be written away hidden, 2nd with thedescriptionis shown).

I would like to be able to use the cascading comboboxes to fill in the
fields and have those records display the correct data (just filled in)
when moving to a next record for wich the comboboxes are re-queried.

Is there a way to solve this?

Thank your for your help and time
 
S

Steve Schapel

Workinghard,

Try it by using VBA procedures on the Enter and Exit events of the
comboboxes to modify their RowSource property. For example, it might be
like this:

Private Sub Combobox2_Enter()
Me.Combobox2.RowSource = "SELECT id, description" & _
" FROM YourQuery WHERE YrFK=" & Me.Combobox1
End Sub

Private Sub Combobox2_Exit(Cancel As Integer)
Me.Combobox2.RowSource = "SELECT id, description FROM YourQuery"
End Sub
 
G

Guest

Hi,

Thx for your efforts. The problem is that when you do that it changes the
source for all records since it is a continuous form. And then the values
for the records disappear where the query produces no match. I think I'll
have to find 'm an other solution.

Thx for your time!
 
S

Steve Schapel

Workinghard,

Really? Did you try it? "The values for the records disappear where
the query produces no match" doesn't happen like that for me! What
version of Access are you using? Please post the exact code you are
using. There are other ways, but what I have suggested is in my opinion
the simplest.
 

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