Combo Box selection / AUTO POPULATE combo box in a different form

K

kealaz

If I have a combo box [VENDORNAME] on one form [frmPO_ISSUE]

and

another combo box [PART_NO] on a different form (actually, it's a
subform of frmPO_ISSUE) [frmORDER_DETAILS]

Can I populate the second combo box based on a selection made in the
first combo box?


When the form [frmPO_ISSUE] is opened, and the user makes a selection
in the combo box [VENDORNAME] to select which vendor we are cutting a
purchase order to, I would like my form to look in a table [tblBUY]
which is all the parts that we currently have an open request for, and
select all parts (one or more) [PART_NO] that match on the field
[VENDORNAME] with the selection made in the combo box [VENDORNAME].


tblBUY
VENDORNAME
PART_NO
MANUF
MANUF_PN
QTY_ORDER
PROJECT


I want the resulting combo box [PART_NO] in my subform
[frmORDER_DETAILS] to look like this

PART_NO = Column(0)
MANUF = Column(1)
MANUF_PN = Column(2)
QTY_ORDER = Column(3)
PROJECT = Column(4)



Thank you very much for any help you can give me with this!!!
 
M

Marshall Barton

If I have a combo box [VENDORNAME] on one form [frmPO_ISSUE]
and another combo box [PART_NO] on a different form (actually, it's a
subform of frmPO_ISSUE) [frmORDER_DETAILS]

Can I populate the second combo box based on a selection made in the
first combo box?

When the form [frmPO_ISSUE] is opened, and the user makes a selection
in the combo box [VENDORNAME] to select which vendor we are cutting a
purchase order to, I would like my form to look in a table [tblBUY]
which is all the parts that we currently have an open request for, and
select all parts (one or more) [PART_NO] that match on the field
[VENDORNAME] with the selection made in the combo box [VENDORNAME].


tblBUY
VENDORNAME
PART_NO
MANUF
MANUF_PN
QTY_ORDER
PROJECT

I want the resulting combo box [PART_NO] in my subform
[frmORDER_DETAILS] to look like this

PART_NO = Column(0)
MANUF = Column(1)
MANUF_PN = Column(2)
QTY_ORDER = Column(3)
PROJECT = Column(4)


The "usual" way is to set the second combo box's Rpw Source
to a query like:

SELECT VENDORNAME, PART_NO, MANUF, MANUF_PN,
QTY_ORDER, PROJECT
FROM tblBUY
WHERE VENDORNAME = Forms!frmPO_ISSUE.VENDORNAME

Then add a line of code to the main form's VENDORNAME combo
box AfterUpdate event:
Me.frmPO_ISSUE.Form.PART_NO.Requery

If the VENDORNAME combo box is a bound control, then you
probably need to add the same line of code to the main
form's Current event.
 
K

kealaz

Marsh,

THANK YOU very much! This worked BEAUTIFULLY! I really appreciate
your help with this.

~Kealaz
 

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