Multiple List Boxes dependant on one another

G

Guest

I am finishing a database here for forecasting our product usage. I want
List Box A to contain account names and List Box B to contain Part numbers
that correlate to the chosen account in List Box A.

How do i set this filter up? Is it even a filter? I'm missing something
easy i fear.

I have successfully created subforms but am unhappy only seeing one account
and part number at a time.
 
G

Guest

You can create a reference in listbox B to list box A, using the RowSource

Select Field1, Field2 From TableName Where FieldName =
Forms![FormName]![ListBoxAName]

On the OnClick event of list box A Run the code
Me.[ListBox B Name].Requery
===========================
 
G

Guest

Thanks for replying so quickly.

Listbox A refers to data in table tbl_Accounts, keyfield is Account_ID

Listbox B refers to data in table tbl_Parts, keyfield is Part_ID, also a
relationship filed is created called Account_ID

Relationships is one to many

In your reply I'm pretty sure I've got the RowSource down. However the
OnClick is confusing. Me.[ListBox B Name].Requery is a Macro. Can you hold
my hand on that?


Ofer Cohen said:
You can create a reference in listbox B to list box A, using the RowSource

Select Field1, Field2 From TableName Where FieldName =
Forms![FormName]![ListBoxAName]

On the OnClick event of list box A Run the code
Me.[ListBox B Name].Requery
===========================



--
Good Luck
BS"D


NateAndMicrosoft said:
I am finishing a database here for forecasting our product usage. I want
List Box A to contain account names and List Box B to contain Part numbers
that correlate to the chosen account in List Box A.

How do i set this filter up? Is it even a filter? I'm missing something
easy i fear.

I have successfully created subforms but am unhappy only seeing one account
and part number at a time.
 

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