Filter a list box by field on a form

J

Jeefgeorge

I have a [Manager Bid Tab Data Subform] subform with fields: [Proj No], [Std
No], and others. The [Proj No] is filled by a field in the master form. The
[Std No] is filled by selecting a value from [StdNoList] list box. The list
box shows the std no for all proj no, I would like it to show the std no for
the Proj No selected on the form.


After Update Event Procedure for [Proj No] text box on the subform:
Private Sub Proj_No_AfterUpdate()
Me!StdNoList.Requery
End Sub


Row Source for [StdNoList] List Box:
SELECT [Line Item Quantities].[Std No], [Engineering Estimating
Guide].Description, [Engineering Estimating Guide].Unit
FROM [Line Item Quantities] INNER JOIN [Engineering Estimating Guide]
ON [Line Item Quantities].[Std No] = [Engineering Estimating Guide].[Std No]
GROUP BY [Line Item Quantities].[Std No], [Engineering Estimating
Guide].Description, [Engineering Estimating Guide].Unit, [Line Item
Quantities].[Proj No]
HAVING ((([Line Item Quantities].[Proj No])=[Forms]![Manager Bid Tab
Data Subform]![Proj No]))
ORDER BY [Line Item Quantities].[Std No];


Every time the form is run, the user is asked to input the “[Forms]![Manager
Bid Tab Data Subform]![Proj No]†parameter.
 
J

Jeefgeorge

So I have adjusted my form, I no longer get the parameter pop up...here is
what I changed:

After Update Event Procedure for [Proj No] text box on the main form:
Private Sub Project_No_AfterUpdate()
Me.[Manager Bid Tab Data Subform].Form![StdNoList].Requery
End Sub

After Update Event Procedure for [Proj No] text box on the subform:
no event here anymore

Row Source for [StdNoList] List Box:
SELECT [Line Item Quantities].[Std No],
[Engineering Estimating Guide].Description,
[Engineering Estimating Guide].Unit
FROM [Line Item Quantities] INNER JOIN
[Engineering Estimating Guide] ON
[Line Item Quantities].[Std No] =
[Engineering Estimating Guide].[Std No]
GROUP BY [Line Item Quantities].[Std No],
[Engineering Estimating Guide].Description,
[Engineering Estimating Guide].Unit,
[Line Item Quantities].[Proj No]
HAVING ((([Line Item Quantities].[Proj No])=[Forms]!
[Add Bid Tab Data for Project Managers]![Project No]))
ORDER BY [Line Item Quantities].[Std No];


However, when I change records on my main form the records shown in the list
box are for the 1st record in the main form. What do I need to change to get
the list box to update when the record changes to a different project number
in the main form?
 

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