More on List Boxes

G

Guest

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 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.
 
G

Guest

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.


--
Good Luck
BS"D


NateAndMicrosoft said:
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 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.
 
G

Guest

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.

Ofer Cohen said:
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.


--
Good Luck
BS"D


NateAndMicrosoft said:
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 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


:

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 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

--
Good Luck
BS"D


NateAndMicrosoft said:
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.

Ofer Cohen said:
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.


--
Good Luck
BS"D


NateAndMicrosoft said:
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?


:

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


:

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

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?


Ofer Cohen said:
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

--
Good Luck
BS"D


NateAndMicrosoft said:
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.

Ofer Cohen said:
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.


--
Good Luck
BS"D


:

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?


:

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


:

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

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

--
Good Luck
BS"D


NateAndMicrosoft said:
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?


Ofer Cohen said:
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

--
Good Luck
BS"D


NateAndMicrosoft said:
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:

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.


--
Good Luck
BS"D


:

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?


:

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


:

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

Is there any way i can email you a zip of this? It's getting so close but
the requery is messing things up.

Ofer Cohen said:
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

--
Good Luck
BS"D


NateAndMicrosoft said:
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?


Ofer Cohen said:
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

--
Good Luck
BS"D


:

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:

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.


--
Good Luck
BS"D


:

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?


:

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


:

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

Send it to

chamudim <@> hotmail <dot> com

Send it ziped, hotmail will remove mdb attachment
 
G

Guest

Thank you for correcting my mistakes. This is wonderful. Thankyou so much
for your help.
-Nathan-
 

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