Cascading Combos with Macros

K

KateAccess

I have not used Macros before but after having a look, I think that they may
be able to help. I would like to have to outcome of combo box 2 be dependant
on combo box 1. Is it possible to do this using a macro? eg if cbo1 = [A],
cbo2 = [fieldA] where A is a record in fieldX and fieldA contains a list of
options dependent on A. Does that make sense?!

Thanks.
 
N

Nikos Yannacopoulos

Kate,

It's definitely doable. Assuming the form is named Form1 and the first
combo is named cbo1: make the second combbo's rowsource a query,
including the table field corresponding to cbo1, and use the following
criterion on it:

Forms![Form1]![cbo1]

(substitute the actual names)

so the rows in cbo2 are dependent on the choice made in cbo1. The only
other thing you need is some means to force cbo2 to reflect every new
choice made in cbo1. To achieve this, use a macro in cbo1 's On Change
event, with an action: Requery, argument: cbo2.

HTH,
Nikos
 
K

KateAccess

Thanks Nikos,

Can you tell me at which point I need to tell Access which details I'll want
in the combo please? At the moment I have a long list in cbo2 and when an
option is chosen in cbo1 I want the list to just contain the appropriate
options. I have separated the long list for cbo2 into a number of fields in
another table. Was that the right way to do it? Will I need to create a
query?

Kate.

Nikos Yannacopoulos said:
Kate,

It's definitely doable. Assuming the form is named Form1 and the first
combo is named cbo1: make the second combbo's rowsource a query,
including the table field corresponding to cbo1, and use the following
criterion on it:

Forms![Form1]![cbo1]

(substitute the actual names)

so the rows in cbo2 are dependent on the choice made in cbo1. The only
other thing you need is some means to force cbo2 to reflect every new
choice made in cbo1. To achieve this, use a macro in cbo1 's On Change
event, with an action: Requery, argument: cbo2.

HTH,
Nikos

I have not used Macros before but after having a look, I think that they may
be able to help. I would like to have to outcome of combo box 2 be dependant
on combo box 1. Is it possible to do this using a macro? eg if cbo1 = [A],
cbo2 = [fieldA] where A is a record in fieldX and fieldA contains a list of
options dependent on A. Does that make sense?!

Thanks.
 
N

Nikos Yannacopoulos

Kate,

Obvioulymy reply wasn't very clear to you, and yours to that isn't any
clearer to me either!
"I have separated the long list for cbo2 into a number of fields in
another table" ??? You've lost me here. I don't have a clue what you
mean, but my guess is that no, this wasn't the right thing to do. If you
want, you are welcome to mail me your database (compact and repair, and
then also zip if possible, please) so I can have a look and give you a
specific answer. My amil address is available here, you just need to do
the obvious.

HTH,
Nikos
Thanks Nikos,

Can you tell me at which point I need to tell Access which details I'll want
in the combo please? At the moment I have a long list in cbo2 and when an
option is chosen in cbo1 I want the list to just contain the appropriate
options. I have separated the long list for cbo2 into a number of fields in
another table. Was that the right way to do it? Will I need to create a
query?

Kate.

:

Kate,

It's definitely doable. Assuming the form is named Form1 and the first
combo is named cbo1: make the second combbo's rowsource a query,
including the table field corresponding to cbo1, and use the following
criterion on it:

Forms![Form1]![cbo1]

(substitute the actual names)

so the rows in cbo2 are dependent on the choice made in cbo1. The only
other thing you need is some means to force cbo2 to reflect every new
choice made in cbo1. To achieve this, use a macro in cbo1 's On Change
event, with an action: Requery, argument: cbo2.

HTH,
Nikos

I have not used Macros before but after having a look, I think that they may
be able to help. I would like to have to outcome of combo box 2 be dependant
on combo box 1. Is it possible to do this using a macro? eg if cbo1 = [A],
cbo2 = [fieldA] where A is a record in fieldX and fieldA contains a list of
options dependent on A. Does that make sense?!

Thanks.
 

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