Thanks for replying so quickly Ofer Cohen.
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" wrote:
> 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
> ===========================
>
> > 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.
Ofer Cohen - 14 Mar 2007 22:17 GMT
I'll try to give youan example:
Form name = FormName
List Box 1 Name - ListBox1
List Box 1 Row Source : Select Field1 From TableName1
List box 2 need to be filtered by the selection on ListBox1
List Box 2 Name - ListBox2
List Box 2 RowSource: Select FieldName From TableName2 Where Field1 =
Forms![FormName]![ListBox1]
In the OnClick event write the code
Me.[ListBox2].Requery
==========================
To go to the OnClick event:
1. open the form in design view
2. From the menu select view > properties
3. Select ListBox1 (click with the mouse on it), in the properties box
you'll see the properties of the list box
4. Find the OnClick property or After Update property, locate the cursor in
it.
5. On the right you'll see a button with three dots, click on it, and select
code view
6. Between the
Sub ...
write the requery here
End Sub
==========================
I hope that example will give you a good start.

Signature
Good Luck
BS"D
> Thanks for replying so quickly Ofer Cohen.
>
[quoted text clipped - 29 lines]
> > > I have successfully created subforms but am unhappy only seeing one account
> > > and part number at a time.
NateAndMicrosoft - 16 Mar 2007 16:10 GMT
Thank you. I am making progress but still gave an issue. Here are my entries:
I am using both boxes on the same form, form name = Fm_1_Accounts
Listbox 1 name = AccountListBox
After Update = Me.[PartsListBox].Requery
Listbox 2 name = PartListBox
Control Source (using primary key from Tbl_1_Accounts) = Account_ID
Row Source = SELECT Tbl_2_Parts.PartNumber FROM Tbl_2_Parts WHERE
Tbl_1_Accounts.account_ID=Forms!Fm_1_Accounts1!AccountListBox;
Upon opening the form it asks me to enter parameter value for
Tbl_1_Accounts.account_ID
I just ckick on OK without entering any parameter and the form opens. How
do i get that to go away?
Also, PartListBox is empty of any data now.
> I'll try to give youan example:
>
[quoted text clipped - 61 lines]
> > > > I have successfully created subforms but am unhappy only seeing one account
> > > > and part number at a time.
Ofer Cohen - 17 Mar 2007 20:45 GMT
You wrote that the form name is Fm_1_Accounts, but in your Row Source you
wrote Fm_1_Accounts1
Forms!Fm_1_Accounts1!AccountListBox
Try changing it to
Forms!Fm_1_Accounts!AccountListBox

Signature
Good Luck
BS"D
> Thank you. I am making progress but still gave an issue. Here are my entries:
>
[quoted text clipped - 80 lines]
> > > > > I have successfully created subforms but am unhappy only seeing one account
> > > > > and part number at a time.
NateAndMicrosoft - 20 Mar 2007 14:38 GMT
Ok, fixed. Still having problems with the Me.[PartsListBox].Requery
When i open the form it says it can not find the macro "Me". THis is true
as i have not written a macro. Is that what needs to happen?
> You wrote that the form name is Fm_1_Accounts, but in your Row Source you
> wrote Fm_1_Accounts1
[quoted text clipped - 88 lines]
> > > > > > I have successfully created subforms but am unhappy only seeing one account
> > > > > > and part number at a time.
Ofer Cohen - 20 Mar 2007 22:57 GMT
Where did you write the requery line?
When you locate the cursor in the property that need to run the requery,
there is a button with three dots on the right, press it and select code
view, and then locate this line inside the Sub, if you write the code
directly in the box it will search for a macro
Sub SubName()
Me.[PartsListBox].Requery
End Sub

Signature
Good Luck
BS"D
> Ok, fixed. Still having problems with the Me.[PartsListBox].Requery
> When i open the form it says it can not find the macro "Me". THis is true
[quoted text clipped - 92 lines]
> > > > > > > I have successfully created subforms but am unhappy only seeing one account
> > > > > > > and part number at a time.
NateAndMicrosoft - 21 Mar 2007 13:39 GMT
Is there any way i can email you a zip of this? It's getting so close but
the requery is messing things up.
> Where did you write the requery line?
>
[quoted text clipped - 103 lines]
> > > > > > > > I have successfully created subforms but am unhappy only seeing one account
> > > > > > > > and part number at a time.
Ofer Cohen - 21 Mar 2007 19:45 GMT
Send it to
chamudim <@> hotmail <dot> com
Send it ziped, hotmail will remove mdb attachment

Signature
Good Luck
BS"D
NateAndMicrosoft - 23 Mar 2007 19:11 GMT
Thanks. It should be in your inbox.
> Send it to
>
> chamudim <@> hotmail <dot> com
>
> Send it ziped, hotmail will remove mdb attachment
Ofer Cohen - 24 Mar 2007 18:14 GMT
Hi,
I didn't get it.
Have you sent it?

Signature
Good Luck
BS"D
> Thanks. It should be in your inbox.
>
[quoted text clipped - 3 lines]
> >
> > Send it ziped, hotmail will remove mdb attachment
NateAndMicrosoft - 28 Mar 2007 00:59 GMT
Yes. I will try to resend it. Check you junk email. nmades <at> checkcorp
<dot> com
> Hi,
>
[quoted text clipped - 8 lines]
> > >
> > > Send it ziped, hotmail will remove mdb attachment
Ofer Cohen - 28 Mar 2007 01:05 GMT
I sent you the MDB, I hope that what you need

Signature
Good Luck
BS"D
> Yes. I will try to resend it. Check you junk email. nmades <at> checkcorp
> <dot> com
[quoted text clipped - 11 lines]
> > > >
> > > > Send it ziped, hotmail will remove mdb attachment
NateAndMicrosoft - 28 Mar 2007 01:01 GMT
Thank you for correcting my mistakes. This is wonderful. Thankyou so much
for your help.
-Nathan-
> I sent you the MDB, I hope that what you need
>
[quoted text clipped - 13 lines]
> > > > >
> > > > > Send it ziped, hotmail will remove mdb attachment