cascading combo box to populate two txt fields

  • Thread starter misschanda via AccessMonster.com
  • Start date
M

misschanda via AccessMonster.com

hello,
i have a cascading combo box that populates the field: txtname on form based
on the final material chosen. (this material comes from a table that has the
material name, id, supplier)
my question is how can i also automatically populate the field txtsupplier
that is associated with the material chosen.

thanks
 
A

Al Campagna

misschanda,
What column of the combo is Supplier in?
(combo columns are numbered left to right 0,1,2,3, ...etc)

Let's say that Supplier is in column 3 (of example [cboMaterialName])
.... then an unbound
text control with a ControlSource of...
= cboMaterialName.Column(3)
will always "display" (not capture) the correct Supplier.
--
hth
Al Campagna
Microsoft Access MVP
http://home.comcast.net/~cccsolutions/index.html

"Find a job that you love... and you'll never work a day in your life."
 
M

misschanda via AccessMonster.com

thanks, worked great however, on the same form i have made an organized
layout to comprise of four experiments (a-
d). the material used for experiment A, is chosen using a cascading combo
box
and automatically fillled in under txt field for experiment A material .

my question is how to make the material selection cascading box work for all
four different potential materials.(A-D).

as of now this is my code

Private Sub Combo0_AfterUpdate()
Me.Combo2.Requery
Me.Combo2 = Null

Me.Combo6.Requery
Me.Combo6 = Null
End Sub

Private Sub Combo2_AfterUpdate()
Me.Combo6.Requery
Me.Combo6 = Null
End Sub

Private Sub Combo6_AfterUpdate()

Forms![LABLINEEXTRUSION1]![ResinA] = Me.Combo6

End Sub

i was referred to allen brown but haven't figured out how to go about this..


thanks.
la

Al said:
misschanda,
What column of the combo is Supplier in?
(combo columns are numbered left to right 0,1,2,3, ...etc)

Let's say that Supplier is in column 3 (of example [cboMaterialName])
... then an unbound
text control with a ControlSource of...
= cboMaterialName.Column(3)
will always "display" (not capture) the correct Supplier.
hello,
i have a cascading combo box that populates the field: txtname on form
[quoted text clipped - 6 lines]
 
A

Al Campagna

misschanda,
You haven't given me any logic as to how the four combo boxes "cascade."
Also, you should name your controls something more meaningful than
Combo0 or Combo6.

An example of a commonly used cascade would be...
cboCountry cboState cboCounty cboTown
where cboCountry controls what states appear in cboStates, and
where cboState controls waht Counties appear in cboCounty... etc...etc...
--
hth
Al Campagna
Microsoft Access MVP
http://home.comcast.net/~cccsolutions/index.html

"Find a job that you love... and you'll never work a day in your life."



misschanda via AccessMonster.com said:
thanks, worked great however, on the same form i have made an organized
layout to comprise of four experiments (a-
d). the material used for experiment A, is chosen using a cascading
combo
box
and automatically fillled in under txt field for experiment A material .

my question is how to make the material selection cascading box work for
all
four different potential materials.(A-D).

as of now this is my code

Private Sub Combo0_AfterUpdate()
Me.Combo2.Requery
Me.Combo2 = Null

Me.Combo6.Requery
Me.Combo6 = Null
End Sub

Private Sub Combo2_AfterUpdate()
Me.Combo6.Requery
Me.Combo6 = Null
End Sub

Private Sub Combo6_AfterUpdate()

Forms![LABLINEEXTRUSION1]![ResinA] = Me.Combo6

End Sub

i was referred to allen brown but haven't figured out how to go about
this..


thanks.
la

Al said:
misschanda,
What column of the combo is Supplier in?
(combo columns are numbered left to right 0,1,2,3, ...etc)

Let's say that Supplier is in column 3 (of example [cboMaterialName])
... then an unbound
text control with a ControlSource of...
= cboMaterialName.Column(3)
will always "display" (not capture) the correct Supplier.
hello,
i have a cascading combo box that populates the field: txtname on form
[quoted text clipped - 6 lines]
 
M

misschanda via AccessMonster.com

al,

the first combo box is category and it is broken down by type of material,
now re-named cboCat
the next combo box is family, named cboFam, and it further breaks the chosen
family down into more sections.
based on the section chose from the family combo box the next combo is of the
names of the materials in that particular section, named cboName
That name is than automatically filled in a text field [resina] on another
form.
I would like this procedure to be done also for fields [resinb], [resinc],
and [resind], since all are different.
would i have to design a Polymer selection form for each resin or can i
modify to the code to automatically fill in the material and supplier

Private Sub Cbocat_AfterUpdate()
Me.CboFam.Requery
Me.CboFam = Null


Me.CboName.Requery
Me.CboName = Null
End Sub


Private Sub CboFam_AfterUpdate()
Me.CboName.Requery
Me.CobName = Null
End Sub

Private Sub CobName_AfterUpdate()

Forms![lablineextrusion1]![ResinA] = Me.CobName

End Sub



thanks

Al said:
misschanda,
You haven't given me any logic as to how the four combo boxes "cascade."
Also, you should name your controls something more meaningful than
Combo0 or Combo6.

An example of a commonly used cascade would be...
cboCountry cboState cboCounty cboTown
where cboCountry controls what states appear in cboStates, and
where cboState controls waht Counties appear in cboCounty... etc...etc...
thanks, worked great however, on the same form i have made an organized
layout to comprise of four experiments (a-
[quoted text clipped - 48 lines]
 
A

Al Campagna

misschanda,
Sorry, but I'm still a bit confused about your setup, and what you're
trying to accomplish.
I'm going to take a guess as to what you're trying to do...

When you select a cboName value, that value will be sent to ResinA on
another form?
If so, your code...
Forms![lablineextrusion1]![ResinA] = Me.CobName
should do that, as long as lablineextrusion1 is open at the time.
Are we good so far?

Now I think you're trying to say that cboName has more columns like
this....
ResinA ResinB ResinC ResinD

If so then on cboName AfterUpdate...
Forms![lablineextrusion1]![ResinA] = Me.cboName
Forms![lablineextrusion1]![ResinB] = Me.cboName.Column(1)
Forms![lablineextrusion1]![ResinC] = Me.cboName.Column(2)
Forms![lablineextrusion1]![ResinD] = Me.cboName.Column(3)
should update the other form fields appropriately.
--
hth
Al Campagna
Microsoft Access MVP
http://home.comcast.net/~cccsolutions/index.html

"Find a job that you love... and you'll never work a day in your life."

misschanda via AccessMonster.com said:
al,

the first combo box is category and it is broken down by type of material,
now re-named cboCat
the next combo box is family, named cboFam, and it further breaks the
chosen
family down into more sections.
based on the section chose from the family combo box the next combo is of
the
names of the materials in that particular section, named cboName
That name is than automatically filled in a text field [resina] on another
form.
I would like this procedure to be done also for fields [resinb], [resinc],
and [resind], since all are different.
would i have to design a Polymer selection form for each resin or can i
modify to the code to automatically fill in the material and supplier

Private Sub Cbocat_AfterUpdate()
Me.CboFam.Requery
Me.CboFam = Null


Me.CboName.Requery
Me.CboName = Null
End Sub


Private Sub CboFam_AfterUpdate()
Me.CboName.Requery
Me.CobName = Null
End Sub

Private Sub CobName_AfterUpdate()

Forms![lablineextrusion1]![ResinA] = Me.CobName

End Sub



thanks

Al said:
misschanda,
You haven't given me any logic as to how the four combo boxes
"cascade."
Also, you should name your controls something more meaningful than
Combo0 or Combo6.

An example of a commonly used cascade would be...
cboCountry cboState cboCounty cboTown
where cboCountry controls what states appear in cboStates, and
where cboState controls waht Counties appear in cboCounty... etc...etc...
thanks, worked great however, on the same form i have made an organized
layout to comprise of four experiments (a-
[quoted text clipped - 48 lines]
 
M

misschanda via AccessMonster.com

Thanks for your patience.

The cboName choice (located on frmpolymerselection) does give me two pieces
of information: the final material name, located in column 1 and the
material's supplier, located in column 2.

The form: frmlablineextrusion1 when open has the fields [resinA]
automatically filled with the material's name from cboName. However,
[supplierA] also located on frmlablineextrusion1 isn't automatically being
filled with the supplier of the assoicated material chosen from cboName. How
can both be filled in automatically?? (code i've been using was posted
earlier)

<Situation 2>

The Form frmlablilneextrusion1 has other 3 other resin (or material input).
i called these fields: [resinb], [resinc],and [resind]. Associated with
these fields are the suppliers fields: [supplierb], [supplierc],and
[supplierd]

Just as in the first situation, the user will need to select the the final
material from a cascading list.(all final material choices will be different)
Is there a way to do this by modifying the earlier code i already have or
must i make 3 other forms like the form: frmpolymerselection??

Thanks
misschanda

Al said:
misschanda,
Sorry, but I'm still a bit confused about your setup, and what you're
trying to accomplish.
I'm going to take a guess as to what you're trying to do...

When you select a cboName value, that value will be sent to ResinA on
another form?
If so, your code...
Forms![lablineextrusion1]![ResinA] = Me.CobName
should do that, as long as lablineextrusion1 is open at the time.
Are we good so far?

Now I think you're trying to say that cboName has more columns like
this....
ResinA ResinB ResinC ResinD

If so then on cboName AfterUpdate...
Forms![lablineextrusion1]![ResinA] = Me.cboName
Forms![lablineextrusion1]![ResinB] = Me.cboName.Column(1)
Forms![lablineextrusion1]![ResinC] = Me.cboName.Column(2)
Forms![lablineextrusion1]![ResinD] = Me.cboName.Column(3)
should update the other form fields appropriately.
[quoted text clipped - 49 lines]
 
A

Al Campagna

misschanda,
I've used the term "cbo" in listbox naming... when we should use "lst in
our "List" names. I rarely work with listboxes.
lstNameA doesn't meant too much...lstMaterialA seems to be clearer as to
what the lists are for.

Create 4 lisboxes...
lstMaterialA, lstMaterialB, lstMaterialC, and lstMaterialD

Each listbox consists of 2 columns, Material and Supplier
On the AfterUpdate event of lstMaterialA...

Private Sub lstMaterialA_AfterUpdate
Me.ResinA = lstMaterialA
Me.SupplierA = lstMaterialA.Column(1)
End Sub

(listbox columns are numbered 0,1,2,3,...etc, so 1 is the Supplier)
Just place that code in the AfterUpdate event of EACH of the lists,
changing the object names appropriately for A thru D.
This will update your form fields with the selected values from your
listboxes.
**If you still have problems, I'll need to see your "exact" code (cut &
paste into your next post)
--
hth
Al Campagna
Microsoft Access MVP
http://home.comcast.net/~cccsolutions/index.html

"Find a job that you love... and you'll never work a day in your life."

misschanda via AccessMonster.com said:
Thanks for your patience.

The cboName choice (located on frmpolymerselection) does give me two
pieces
of information: the final material name, located in column 1 and the
material's supplier, located in column 2.

The form: frmlablineextrusion1 when open has the fields [resinA]
automatically filled with the material's name from cboName. However,
[supplierA] also located on frmlablineextrusion1 isn't automatically being
filled with the supplier of the assoicated material chosen from cboName.
How
can both be filled in automatically?? (code i've been using was posted
earlier)

<Situation 2>

The Form frmlablilneextrusion1 has other 3 other resin (or material
input).
i called these fields: [resinb], [resinc],and [resind]. Associated with
these fields are the suppliers fields: [supplierb], [supplierc],and
[supplierd]

Just as in the first situation, the user will need to select the the final
material from a cascading list.(all final material choices will be
different)
Is there a way to do this by modifying the earlier code i already have or
must i make 3 other forms like the form: frmpolymerselection??

Thanks
misschanda

Al said:
misschanda,
Sorry, but I'm still a bit confused about your setup, and what you're
trying to accomplish.
I'm going to take a guess as to what you're trying to do...

When you select a cboName value, that value will be sent to ResinA on
another form?
If so, your code...
Forms![lablineextrusion1]![ResinA] = Me.CobName
should do that, as long as lablineextrusion1 is open at the time.
Are we good so far?

Now I think you're trying to say that cboName has more columns like
this....
ResinA ResinB ResinC ResinD

If so then on cboName AfterUpdate...
Forms![lablineextrusion1]![ResinA] = Me.cboName
Forms![lablineextrusion1]![ResinB] = Me.cboName.Column(1)
Forms![lablineextrusion1]![ResinC] = Me.cboName.Column(2)
Forms![lablineextrusion1]![ResinD] = Me.cboName.Column(3)
should update the other form fields appropriately.
[quoted text clipped - 49 lines]
 

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