cascading combobox with a difference - maybe?????

M

Microsoft

Access 2007

I have 2 cascading comboboxes on a continuous sub form.

If I change Combobox1 on record 1
and click on combox2 on a different record( the form is continuous)
combobox2 on record 2(for eg) relates to the value entered in combobox1 on
record 1

ie.
combox1 options: science, humanities,
language
combox2 options: biology, phyhsics, chemistry geography, history
French, German
combobox 1 combobox2
record 1 science biology options
incl, biology, physics, chemistry
record 2 humanities geography options incl
geography, history

If I change combobox 1 in record1 to language and then click on the combobox
in record 2 the options are French & German even though I haven't changed
combobox1 for record 2

How can i stop this from happening?

Thanks

Alison
 
D

Dirk Goldgar

Microsoft said:
Access 2007

I have 2 cascading comboboxes on a continuous sub form.

If I change Combobox1 on record 1
and click on combox2 on a different record( the form is continuous)
combobox2 on record 2(for eg) relates to the value entered in combobox1 on
record 1

ie.
combox1 options: science, humanities,
language
combox2 options: biology, phyhsics, chemistry geography, history
French, German
combobox 1 combobox2
record 1 science biology options
incl, biology, physics, chemistry
record 2 humanities geography options incl
geography, history

If I change combobox 1 in record1 to language and then click on the
combobox in record 2 the options are French & German even though I haven't
changed combobox1 for record 2

How can i stop this from happening?

Thanks

Alison


On a continuous form, there's really only one instance of each control, just
displayed multiple times, once for each record. So if you're using the
AfterUpdate event for combobox1 to requery or change the rowsource for
combobox2, that's going to affect all instances of combobox2.

To get around this in a continuous form, I recommend using the Enter or
GotFocus event of combobox2 to requery it or change its rowsource (whichever
approach you are currently using), instead of using the AfterUpdate event of
combobox1. That way, whenever you click on or tab into combobox2, it will
have the rowsource that is appropriate to the current record.
 
M

Microsoft

Thanks - works a treat
Dirk Goldgar said:
On a continuous form, there's really only one instance of each control,
just displayed multiple times, once for each record. So if you're using
the AfterUpdate event for combobox1 to requery or change the rowsource for
combobox2, that's going to affect all instances of combobox2.

To get around this in a continuous form, I recommend using the Enter or
GotFocus event of combobox2 to requery it or change its rowsource
(whichever approach you are currently using), instead of using the
AfterUpdate event of combobox1. That way, whenever you click on or tab
into combobox2, it will have the rowsource that is appropriate to the
current record.

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)
 

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