I have a Form in Access 2003 which contains a List box which pulls ID's from the Main table for the form. What I want to do is have the three Combo boxes on the form to be the filter for the list box. I have tried several ways of getting this to work.
The first ComboBox uses the following VBA:
Private Sub Form_Load()
'sets the list for the first Combobox
Me.Combo142.RowSource = "SELECT [CCC].[CCode] " & " FROM CCC ORDER BY CCode;"
Me.Combo142.Requery
End Sub
Private Sub Combo142_AfterUpdate()
'Clears the second Combobox when the value of the
'first Combobox has changed
Me.Option123 = Null
End Sub
Private Sub Option123_GotFocus()
'sets the list for the second Combobox
'based on the selection in the OptionsButtons
Me.Combo142.RowSource = "SELECT [CCAH].[Year_Month] " & " FROM CCAH " & " ; "
End Sub
The second Combo:
SELECT ID, [PGCode] & " " & [PGCodeDesc] AS Expr1 FROM PGCodes ORDER BY PGCodes.PGCode;
The third Combo:
SELECT PDCodes.ID, [PDCodes] & " " & [PDCodeDesc] AS Expr1 FROM PDCodes ORDER BY PDCodes.PDCodes;
I need to use those Combo Boxes for the List box to filter. I tried setting up simple queries, but if I enter the name of the queries in the List Box Row Source they don't show up unless I click on Design View for the Form and then return to Form view. As if I need to activate the query before it will display data.
I have worked on this for several days without much success...HELP.
The first ComboBox uses the following VBA:
Private Sub Form_Load()
'sets the list for the first Combobox
Me.Combo142.RowSource = "SELECT [CCC].[CCode] " & " FROM CCC ORDER BY CCode;"
Me.Combo142.Requery
End Sub
Private Sub Combo142_AfterUpdate()
'Clears the second Combobox when the value of the
'first Combobox has changed
Me.Option123 = Null
End Sub
Private Sub Option123_GotFocus()
'sets the list for the second Combobox
'based on the selection in the OptionsButtons
Me.Combo142.RowSource = "SELECT [CCAH].[Year_Month] " & " FROM CCAH " & " ; "
End Sub
The second Combo:
SELECT ID, [PGCode] & " " & [PGCodeDesc] AS Expr1 FROM PGCodes ORDER BY PGCodes.PGCode;
The third Combo:
SELECT PDCodes.ID, [PDCodes] & " " & [PDCodeDesc] AS Expr1 FROM PDCodes ORDER BY PDCodes.PDCodes;
I need to use those Combo Boxes for the List box to filter. I tried setting up simple queries, but if I enter the name of the queries in the List Box Row Source they don't show up unless I click on Design View for the Form and then return to Form view. As if I need to activate the query before it will display data.
I have worked on this for several days without much success...HELP.