COmbo box1 combo box2

M

Motore

After to have created in a Form

Respectively the COMBO BOX1 and the COMBO BOX2:
where the COMBO BOX1 it reads from a list :
In which we have:
-Door
- window while
COMBO [BOX2 from type list:
[P1]
[P2]
[P3]
[F1]
[F2]
[F3]
Now when the [COMBO] [BOX1] = given on the [COMBO] [BOX2] has to appear
[P1]
[P2]
[P3]
While when [COMBO] [BOX1] = window on the [COMBO] [BOX2] has to appear me:

[F1]
[F2]
[F3]
I enclose code [VBA] for [EXCEL], while need to do for [VBA] [ACCESS].

Code for [VBA] [EXCEL]:

[SET] [PNG] = [SH]. [RANGE](" [E3], [E4]")
[WITH] me. [COMBOBOX2]
. [CLEAR]
[FOR] [EACH] [RCELL] in [PNG]. [CELLS]
. [ADDITEM] [RCELL]. [VALUE]
[NEXT] [RCELL]
. [LISTINDEX] = 0
[END] [WITH]
Thank you
 
J

John W. Vinson

After to have created in a Form

Respectively the COMBO BOX1 and the COMBO BOX2:
where the COMBO BOX1 it reads from a list :
In which we have:
-Door
- window while
COMBO [BOX2 from type list:
[P1]
[P2]
[P3]
[F1]
[F2]
[F3]
Now when the [COMBO] [BOX1] = given on the [COMBO] [BOX2] has to appear
[P1]
[P2]
[P3]
While when [COMBO] [BOX1] = window on the [COMBO] [BOX2] has to appear me:

[F1]
[F2]
[F3]
I enclose code [VBA] for [EXCEL], while need to do for [VBA] [ACCESS].

Code for [VBA] [EXCEL]:

[SET] [PNG] = [SH]. [RANGE](" [E3], [E4]")
[WITH] me. [COMBOBOX2]
. [CLEAR]
[FOR] [EACH] [RCELL] in [PNG]. [CELLS]
. [ADDITEM] [RCELL]. [VALUE]
[NEXT] [RCELL]
. [LISTINDEX] = 0
[END] [WITH]
Thank you

Excel is a spreadsheet, best of its class.
Access is a relational database.

*They are not equivalent* and they do not work in the same way! For one thing,
you don't use Additem in a combo box; instead, a combo box will typically be
based on a Query returning the desired items.

In this case, you want Combo Box 2 to retrieve one subset of records or a
different subset based on the selection in combo box 1. I presume there is
something in the table to indicate that a record pertains to a window or to a
door? What is the actual structure of your list?


John W. Vinson [MVP]
 

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